Skip to content

Commit 5f78b90

Browse files
authored
Add gemma model to prod config (#854)
* Add `google/gemma-7b-it` to production config * Add gemma prompt format to PROMPTS.md * Make sampling parameters optional
1 parent 25c844d commit 5f78b90

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed

.env.template

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,34 @@ MODELS=`[
3131
}
3232
]
3333
},
34-
{
34+
{
35+
"name" : "google/gemma-7b-it",
36+
"description": "Gemma 7B is from a family of lightweight models from Google built from the same research and technology used to create the Gemini models.",
37+
"websiteUrl" : "https://add-link-to-their-comms-here.com/",
38+
"logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/google-logo.png",
39+
"modelUrl": "https://huggingface.co/google/gemma-7b-it",
40+
"preprompt": "",
41+
"chatPromptTemplate" : "{{#each messages}}{{#ifUser}}<start_of_turn>user\n{{#if @first}}{{#if @root.preprompt}}{{@root.preprompt}}\n{{/if}}{{/if}}{{content}}<end_of_turn>\n<start_of_turn>model\n{{/ifUser}}{{#ifAssistant}}{{content}}<end_of_turn>\n{{/ifAssistant}}{{/each}}",
42+
"promptExamples": [
43+
{
44+
"title": "Write an email from bullet list",
45+
"prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)"
46+
}, {
47+
"title": "Code a snake game",
48+
"prompt": "Code a basic snake game in python, give explanations for each step."
49+
}, {
50+
"title": "Assist in a task",
51+
"prompt": "How do I make a delicious lemon cheesecake?"
52+
}
53+
],
54+
"parameters": {
55+
"do_sample": true,
56+
"truncate": 7168,
57+
"max_new_tokens": 1024,
58+
"stop" : ["<end_of_turn>"]
59+
}
60+
},
61+
{
3562
"name": "meta-llama/Llama-2-70b-chat-hf",
3663
"description": "The latest and biggest model from Meta, fine-tuned for chat.",
3764
"logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/meta-logo.png",

PROMPTS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,9 @@ System: {{preprompt}}\nUser:{{#each messages}}{{#ifUser}}{{content}}\nFalcon:{{/
6161
```env
6262
<s>{{#if @root.preprompt}}Source: system\n\n {{@root.preprompt}} <step> {{/if}}{{#each messages}}{{#ifUser}}Source: user\n\n {{content}} <step> {{/ifUser}}{{#ifAssistant}}Source: assistant\n\n {{content}} <step> {{/ifAssistant}}{{/each}}Source: assistant\nDestination: user\n\n ``
6363
```
64+
65+
## Gemma
66+
67+
```env
68+
{{#each messages}}{{#ifUser}}<start_of_turn>user\n{{#if @first}}{{#if @root.preprompt}}{{@root.preprompt}}\n{{/if}}{{/if}}{{content}}<end_of_turn>\n<start_of_turn>model\n{{/ifUser}}{{#ifAssistant}}{{content}}<end_of_turn>\n{{/ifAssistant}}{{/each}}
69+
```

src/lib/server/models.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ const modelConfig = z.object({
5858
endpoints: z.array(endpointSchema).optional(),
5959
parameters: z
6060
.object({
61-
temperature: z.number().min(0).max(1),
61+
temperature: z.number().min(0).max(1).optional(),
6262
truncate: z.number().int().positive().optional(),
63-
max_new_tokens: z.number().int().positive(),
63+
max_new_tokens: z.number().int().positive().optional(),
6464
stop: z.array(z.string()).optional(),
6565
top_p: z.number().positive().optional(),
6666
top_k: z.number().positive().optional(),

0 commit comments

Comments
 (0)