Skip to content

Commit

Permalink
Add Gemma chat framing
Browse files Browse the repository at this point in the history
Gemma doesn't have specific support for system prompts but adding it to
the first user prompt seems to work.
  • Loading branch information
zeux committed Apr 19, 2024
1 parent 3cb74ed commit 3a12ad9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/run.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,9 @@ static const char* chatframe(const char* style, bool has_system) {
} else if (strcmp(style, "qwen2") == 0) {
return has_system ? "<|im_start|>system\n%s<|im_end|>\n<|im_start|>user\n%s<|im_end|>\n<|im_start|>assistant\n"
: "\n<|im_start|>user\n%s<|im_end|>\n<|im_start|>assistant\n";
} else if (strcmp(style, "gemma") == 0) {
return has_system ? "<start_of_turn>user\nSYSTEM: %s\n%s<end_of_turn>\n<start_of_turn>model\n"
: "<start_of_turn>user\n%s<end_of_turn>\n<start_of_turn>model\n";
} else {
return has_system ? "[INST] <<SYS>>\n%s\n<</SYS>>\n\n%s [/INST]" : "[INST] %s [/INST]";
}
Expand Down

0 comments on commit 3a12ad9

Please sign in to comment.