Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -72,14 +72,21 @@ def prepare_prompt(prompt, chat_history):
|
|
| 72 |
|
| 73 |
def apply_prompt_syntax(prompt, system_prompt, prompt_template, bake_in_prompt_syntax):
|
| 74 |
model_family_syntax = {
|
| 75 |
-
|
| 76 |
-
"
|
| 77 |
-
"
|
| 78 |
-
|
| 79 |
-
"
|
| 80 |
-
"
|
| 81 |
-
|
| 82 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
}
|
| 84 |
|
| 85 |
if bake_in_prompt_syntax:
|
|
|
|
| 72 |
|
| 73 |
def apply_prompt_syntax(prompt, system_prompt, prompt_template, bake_in_prompt_syntax):
|
| 74 |
model_family_syntax = {
|
| 75 |
+
### Llama Models
|
| 76 |
+
"llama3_instruct - system": """<|begin_of_text|><|start_header_id|>system<|end_header_id|>\n\n{system_prompt}<|eot_id|><|start_header_id|>user<|end_header_id|>\n\n{prompt}<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n""",
|
| 77 |
+
"llama3_instruct - user": """<|begin_of_text|><|start_header_id|>user<|end_header_id|>\n\n{prompt}<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n""",
|
| 78 |
+
### Granite Models
|
| 79 |
+
"granite_3 - system": """<|start_of_role|>system<|end_of_role|>{system_prompt}<|end_of_text|>\n<|start_of_role|>user<|end_of_role|>{prompt}<|end_of_text|>\n<|start_of_role|>assistant<|end_of_role|>""",
|
| 80 |
+
"granite_3 - user": """<|start_of_role|>user<|end_of_role|>{prompt}<|end_of_text|>\n<|start_of_role|>assistant<|end_of_role|>""",
|
| 81 |
+
### Granite Code Only
|
| 82 |
+
"granite_code - with system": """System:\n{system_prompt}\n\nQuestion:\n{prompt}\n\nAnswer:\n""",
|
| 83 |
+
"granite_code - instruction only": """Question:\n{prompt}\n\nAnswer:\n""",
|
| 84 |
+
### Mistral Models
|
| 85 |
+
"mistral_ai models sys": """<s>[INST] System Prompt: {system_prompt} \n\n User Prompt: {prompt} [/INST]\n\n""",
|
| 86 |
+
"mistral_ai models": """<s>[INST] {prompt} [/INST]\n\n""",
|
| 87 |
+
### No Syntax
|
| 88 |
+
"no syntax - system": """{system_prompt}\n\n{prompt}""",
|
| 89 |
+
"no syntax - user": """{prompt}""",
|
| 90 |
}
|
| 91 |
|
| 92 |
if bake_in_prompt_syntax:
|