Skip to content

Commit

Permalink
Added Nemotron-4 prompt template.
Browse files Browse the repository at this point in the history
  • Loading branch information
sszymczy committed Jul 15, 2024
1 parent 9e982b0 commit 32f565a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions run_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
VICUNA_PROMPT_TEMPLATE="{SYS}\nUSER: {USER}\nASSISTANT:"
PHI3_PROMPT_TEMPLATE=None
DEEPSEEK2_PROMPT_TEMPLATE="{SYS}\n\nUser: {USER}\n\nAssistant:"
NEMOTRON4_PROMPT_TEMPLATE="<extra_id_0>System\n{SYS}\n<extra_id_1>User\n{USER}\n<extra_id_1>Assistant\n"
else:
LLAMA_PROMPT_TEMPLATE="<s>[INST] {USER}[/INST]\n"
LLAMA3_PROMPT_TEMPLATE="<|begin_of_text|><|start_header_id|>user<|end_header_id|>\n\n{USER}<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n"
Expand All @@ -39,6 +40,7 @@
VICUNA_PROMPT_TEMPLATE="USER: {USER}\nASSISTANT: "
PHI3_PROMPT_TEMPLATE="<|user|>\n{USER}<|end|>\n<|assistant|>"
DEEPSEEK2_PROMPT_TEMPLATE="User: {USER}\n\nAssistant:"
NEMOTRON4_PROMPT_TEMPLATE="<extra_id_0>System\n\n<extra_id_1>User\n{USER}<extra_id_1>Assistant\n"

model_file_basename = os.path.basename(model_file)

Expand All @@ -56,6 +58,8 @@
prompt_template = PHI3_PROMPT_TEMPLATE
elif any(model_name in model_file_basename.lower() for model_name in ["deepseek-v2"]):
prompt_template = DEEPSEEK2_PROMPT_TEMPLATE
elif any(model_name in model_file_basename.lower() for model_name in ["nemotron"]):
prompt_template = NEMOTRON4_PROMPT_TEMPLATE
else:
raise RuntimeError("Could not detect model prompt template!")

Expand Down

0 comments on commit 32f565a

Please sign in to comment.