Skip to content

Commit

Permalink
Added support for Aya-23 and DeepSeek-V2 models.
Browse files Browse the repository at this point in the history
  • Loading branch information
sszymczy committed May 28, 2024
1 parent 6534c86 commit ac694bd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion run_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@
COMMANDR_PROMPT_TEMPLATE="<BOS_TOKEN><|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>{SYS}<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|USER_TOKEN|>{USER}<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>"
VICUNA_PROMPT_TEMPLATE="{SYS}\nUSER: {USER}\nASSISTANT:"
PHI3_PROMPT_TEMPLATE=None
DEEPSEEK2_PROMPT_TEMPLATE="{SYS}\n\nUser: {USER}\n\nAssistant:"
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"
CHATML_PROMPT_TEMPLATE="<|im_start|>user\n{USER}<|im_end|>\n<|im_start|>assistant\n"
COMMANDR_PROMPT_TEMPLATE="<BOS_TOKEN><|START_OF_TURN_TOKEN|><|USER_TOKEN|>{USER}<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>"
VICUNA_PROMPT_TEMPLATE="USER: {USER}\nASSISTANT: "
PHI3_PROMPT_TEMPLATE="<|user|>\n{USER}<|end|>\n<|assistant|>"
DEEPSEEK2_PROMPT_TEMPLATE="User: {USER}\n\nAssistant:"

model_file_basename = os.path.basename(model_file)

Expand All @@ -46,12 +48,14 @@
prompt_template = LLAMA_PROMPT_TEMPLATE
elif any(model_name in model_file_basename.lower() for model_name in ["qwen", "yi", "dbrx-instruct", "theprofessor", "smaug", "arctic"]):
prompt_template = CHATML_PROMPT_TEMPLATE
elif any(model_name in model_file_basename.lower() for model_name in ["command-r"]):
elif any(model_name in model_file_basename.lower() for model_name in ["command-r", "aya-23"]):
prompt_template = COMMANDR_PROMPT_TEMPLATE
elif any(model_name in model_file_basename.lower() for model_name in ["wizardlm"]):
prompt_template = VICUNA_PROMPT_TEMPLATE
elif any(model_name in model_file_basename.lower() for model_name in ["phi-3"]):
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
else:
raise RuntimeError("Could not detect model prompt template!")

Expand Down

0 comments on commit ac694bd

Please sign in to comment.