Skip to content

Commit

Permalink
Update chat_templates.py
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhanchen committed Jun 18, 2024
1 parent 676b20b commit 89b7807
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion unsloth/chat_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,12 @@ def construct_chat_template( \
ollama_system = ollama_system[len(tokenizer.bos_token):]
pass
pass
system_modelfile = "{{ if .System }}" + ollama_system.replace("{SYSTEM}", "{{ .System }}") + "{{ end }}"
# Check system
if "{SYSTEM}" in ollama_system:
system_modelfile = "{{ if .System }}" + ollama_system.replace("{SYSTEM}", "{{ .System }}") + "{{ end }}"
else:
system_modelfile = ollama_system
pass
input_modelfile = "{{ if .Prompt }}" + input_part .replace("{INPUT}", "{{ .Prompt }}") + "{{ end }}"
output_modelfile = output_part.replace("{OUTPUT}", "{{ .Response }}")

Expand Down

0 comments on commit 89b7807

Please sign in to comment.