Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
9468c682
Unverified
Commit
9468c682
authored
Aug 30, 2024
by
Michael Yang
Committed by
GitHub
Aug 30, 2024
Browse files
Merge pull request #6534 from ollama/mxyng/messages
update templates to use messages
parents
56346ccf
413ae39f
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
144 additions
and
83 deletions
+144
-83
server/routes_create_test.go
server/routes_create_test.go
+2
-2
template/alfred.gotmpl
template/alfred.gotmpl
+2
-1
template/alpaca.gotmpl
template/alpaca.gotmpl
+15
-5
template/chatml.gotmpl
template/chatml.gotmpl
+2
-5
template/chatqa.gotmpl
template/chatqa.gotmpl
+6
-5
template/codellama-70b-instruct.gotmpl
template/codellama-70b-instruct.gotmpl
+7
-7
template/falcon-instruct.gotmpl
template/falcon-instruct.gotmpl
+7
-4
template/gemma-instruct.gotmpl
template/gemma-instruct.gotmpl
+16
-5
template/granite-instruct.gotmpl
template/granite-instruct.gotmpl
+6
-7
template/llama2-chat.gotmpl
template/llama2-chat.gotmpl
+13
-5
template/llama3-instruct.gotmpl
template/llama3-instruct.gotmpl
+3
-5
template/magicoder.gotmpl
template/magicoder.gotmpl
+14
-5
template/mistral-instruct.gotmpl
template/mistral-instruct.gotmpl
+5
-2
template/openchat.gotmpl
template/openchat.gotmpl
+6
-1
template/phi-3.gotmpl
template/phi-3.gotmpl
+2
-5
template/solar-instruct.gotmpl
template/solar-instruct.gotmpl
+8
-6
template/starcoder2-instruct.gotmpl
template/starcoder2-instruct.gotmpl
+15
-5
template/vicuna.gotmpl
template/vicuna.gotmpl
+13
-3
template/zephyr.gotmpl
template/zephyr.gotmpl
+2
-5
No files found.
server/routes_create_test.go
View file @
9468c682
...
@@ -593,9 +593,9 @@ func TestCreateDetectTemplate(t *testing.T) {
...
@@ -593,9 +593,9 @@ func TestCreateDetectTemplate(t *testing.T) {
checkFileExists
(
t
,
filepath
.
Join
(
p
,
"blobs"
,
"*"
),
[]
string
{
checkFileExists
(
t
,
filepath
.
Join
(
p
,
"blobs"
,
"*"
),
[]
string
{
filepath
.
Join
(
p
,
"blobs"
,
"sha256-0d79f567714c62c048378f2107fb332dabee0135d080c302d884317da9433cc5"
),
filepath
.
Join
(
p
,
"blobs"
,
"sha256-0d79f567714c62c048378f2107fb332dabee0135d080c302d884317da9433cc5"
),
filepath
.
Join
(
p
,
"blobs"
,
"sha256-35360843d0c84fb1506952a131bbef13cd2bb4a541251f22535170c05b56e672"
),
filepath
.
Join
(
p
,
"blobs"
,
"sha256-553c4a3f747b3d22a4946875f1cc8ed011c2930d83f864a0c7265f9ec0a20413"
),
filepath
.
Join
(
p
,
"blobs"
,
"sha256-553c4a3f747b3d22a4946875f1cc8ed011c2930d83f864a0c7265f9ec0a20413"
),
filepath
.
Join
(
p
,
"blobs"
,
"sha256-c608dc615584cd20d9d830363dabf8a4783ae5d34245c3d8c115edb3bc7b28e4"
),
filepath
.
Join
(
p
,
"blobs"
,
"sha256-de3959f841e9ef6b4b6255fa41cb9e0a45da89c3066aa72bdd07a4747f848990"
),
filepath
.
Join
(
p
,
"blobs"
,
"sha256-ea34c57ba5b78b740aafe2aeb74dc6507fc3ad14170b64c26a04fb9e36c88d75"
),
})
})
})
})
...
...
template/alfred.gotmpl
View file @
9468c682
{{ if .System }}<start_system>{{ .System }}<end_message>{{ end }}{{ if .Prompt }}<start_user>{{ .Prompt }}<end_message>{{ end }}<start_assistant>{{ .Response }}<end_message>
{{- range .Messages }}<start_{{ .Role }}>{{ .Content }}<end_message>
\ No newline at end of file
{{- end }}<start_assistant>
\ No newline at end of file
template/alpaca.gotmpl
View file @
9468c682
{{ if .System }}{{ .System }}
{{- $system := "" }}
{{- range .Messages }}
{{- if eq .Role "system" }}
{{- if not $system }}{{ $system = .Content }}
{{- else }}{{ $system = printf "%s\n\n%s" $system .Content }}
{{- end }}
{{- else if eq .Role "user" }}
{{- if $system }}{{ $system }}
{{ end }}{{ if .Prompt }}### Instruction:
{{ $system = "" }}
{{ .Prompt }}
{{- end }}### Instruction:
{{ .Content }}
{{ e
nd
}}### Response:
{{ e
lse if eq .Role "assistant"
}}### Response:
{{ .
Response
}}
{{ .
Content
}}
{{ end }}
{{- end }}### Response:
template/chatml.gotmpl
View file @
9468c682
{{ if .System }}<|im_start|>system
{{- range .Messages }}<|im_start|>{{ .Role }}
{{ .System }}<|im_end|>
{{ .Content }}<|im_end|>
{{ end }}{{ if .Prompt }}<|im_start|>user
{{ .Prompt }}<|im_end|>
{{ end }}<|im_start|>assistant
{{ end }}<|im_start|>assistant
{{ .Response }}<|im_end|>
template/chatqa.gotmpl
View file @
9468c682
{{
if .System }}System: {{ .System
}}
{{
- range .Messages
}}
{{- if eq .Role "system" }}System:
{{ e
nd }}{{ if .Prompt }}User: {{ .Prompt }}
{{
-
e
lse if eq .Role "user" }}User:
{{- else if eq .Role "assistant" }}Assistant:
{{ end }}
Assistant: {{ .Response
}}
{{
-
end }}
{{ .Content
}}
{{ end }}Assistant:
\ No newline at end of file
template/codellama-70b-instruct.gotmpl
View file @
9468c682
{{ if .System }}Source: system
{{- range .Messages }}Source:
{{- if eq .Role "system" }} system
{{ .System }} <step> {{ end }}Source: user
{{- else if eq .Role "user" }} user
{{- else if eq .Role "assistant" }} assistant
{{- end }}
{{ .Prompt }} <step> Source: assistant
{{ .Content }} <step> {{ end }}Source: assistant
{{- if not .Response }}
Destination: user
Destination: user
{{- end }}
{{ .Response }} <step>
\ No newline at end of file
\ No newline at end of file
template/falcon-instruct.gotmpl
View file @
9468c682
{{ if .System }}System: {{ .System }}
{{- range .Messages }}
{{ end }}{{ if .Prompt }}User:
{{- if eq .Role "system" }}System: {{ .Content }}
{{ .Prompt }}
{{ continue }}
{{- else if eq .Role "user" }}User:
{{- else if eq .Role "assistant" }}Falcon:
{{- end }}
{{ .Content }}
{{ end }}Falcon:
{{ end }}Falcon:
{{ .Response }}
template/gemma-instruct.gotmpl
View file @
9468c682
<start_of_turn>user
{{- $system := "" }}
{{ if .System }}{{ .System }}
{{- range .Messages }}
{{ end }}{{ .Prompt }}<end_of_turn>
{{- if eq .Role "system" }}
<start_of_turn>model
{{- if not $system }}{{ $system = .Content }}
{{ .Response }}<end_of_turn>
{{- else }}{{ $system = printf "%s\n\n%s" $system .Content }}
{{- end }}
{{- continue }}
{{- else if eq .Role "user" }}<start_of_turn>user
{{- if $system }}
{{ $system }}
{{- $system = "" }}
{{- end }}
{{- else if eq .Role "assistant" }}<start_of_turn>model
{{- end }}
{{ .Content }}<end_of_turn>
{{ end }}<start_of_turn>model
template/granite-instruct.gotmpl
View file @
9468c682
{{ if .System }}System:
{{- range .Messages }}
{{ .System }}
{{- if eq .Role "system" }}System:
{{- else if eq .Role "user" }}Question:
{{ end }}{{ if .Prompt }}Question:
{{- else if eq .Role "assistant" }}Answer:
{{ .Prompt }}
{{- end }}
{{ .Content }}
{{ end }}Answer:
{{ end }}Answer:
{{ .Response }}
template/llama2-chat.gotmpl
View file @
9468c682
[INST] <<SYS>>
{{- $system := "" }}[INST] {{ range .Messages }}
{{- if .System }}
{{- if eq .Role "system" }}
{{ .System }}
{{- if not $system }}{{ $system = .Content }}
{{ end }}<</SYS>>
{{- else }}{{ $system = printf "%s\n\n%s" $system .Content }}
{{- end }}
{{- else if eq .Role "user" }}<<SYS>>
{{- if $system }}
{{ $system }}
{{ $system = "" }}
{{- end }}<</SYS>>
{{ .Prompt }} [/INST] {{ .Response }}</s><s>
{{ .Content }} [/INST]
\ No newline at end of file
{{- else if eq .Role "assistant" }} {{ .Content }}</s><s>[INST] {{ end }}
{{- end }}
\ No newline at end of file
template/llama3-instruct.gotmpl
View file @
9468c682
{{
if .System
}}<|start_header_id|>
system
<|end_header_id|>
{{
- range .Messages
}}<|start_header_id|>
{{ .Role }}
<|end_header_id|>
{{ .System }}<|eot_id|>{{ end }}{{ if .Prompt }}<|start_header_id|>user<|end_header_id|>
{{ .Content }}<|eot_id|>
{{- end }}<|start_header_id|>assistant<|end_header_id|>
{{ .Prompt }}<|eot_id|>{{ end }}<|start_header_id|>assistant<|end_header_id|>
{{ .Response }}<|eot_id|>
\ No newline at end of file
template/magicoder.gotmpl
View file @
9468c682
{{ if .System }}{{ .System }}
{{- $system := "" }}
{{- range .Messages }}
{{- if eq .Role "system" }}
{{- if not $system }}{{ $system = .Content }}
{{- else }}{{ $system = printf "%s\n\n%s" $system .Content }}
{{- end }}
{{- continue }}
{{- else if eq .Role "user" }}
{{- if $system }}{{ $system }}
{{ end }}{{ if .Prompt }}@@ Instruction
{{ $system = "" }}
{{ .Prompt }}
{{- end }}@@ Instruction
{{- else if eq .Role "assistant" }}@@ Response
{{- end }}
{{ .Content }}
{{ end }}@@ Response
{{ end }}@@ Response
{{ .Response }}
template/mistral-instruct.gotmpl
View file @
9468c682
[INST] {{ if .System }}{{ .System }}
[INST] {{ range $index, $_ := .Messages }}
{{- if eq .Role "system" }}{{ .Content }}
{{ end }}{{ .Prompt }}[/INST] {{ .Response }}</s>
{{ else if eq .Role "user" }}{{ .Content }}[/INST]
\ No newline at end of file
{{- else if eq .Role "assistant" }} {{ .Content }}</s>[INST] {{ end }}
{{- end }}
\ No newline at end of file
template/openchat.gotmpl
View file @
9468c682
{{ if .System }}GPT4 Correct System: {{ .System }}<|end_of_turn|>{{ end }}GPT4 Correct User: {{ .Prompt }}<|end_of_turn|>GPT4 Correct Assistant: {{ .Response }}<|end_of_turn|>
{{- range .Messages }}GPT4 Correct
\ No newline at end of file
{{- if eq .Role "system" }} System:
{{- else if eq .Role "user" }} User:
{{- else if eq .Role "assistant" }} Assistant:
{{- end }} {{ .Content }}<|end_of_turn|>
{{- end }}GPT4 Correct Assistant:
\ No newline at end of file
template/phi-3.gotmpl
View file @
9468c682
{{ if .System }}<|system|>
{{- range .Messages }}<|{{ .Role }}|>
{{ .System }}<|end|>
{{ .Content }}<|end|>
{{ end }}{{ if .Prompt }}<|user|>
{{ .Prompt }}<|end|>
{{ end }}<|assistant|>
{{ end }}<|assistant|>
{{ .Response }}<|end|>
template/solar-instruct.gotmpl
View file @
9468c682
{{ if .System }}### System:
{{- range .Messages }}
{{ .System }}
{{- if eq .Role "system" }}### System:
{{- else if eq .Role "user" }}### User:
{{- else if eq .Role "assistant" }}### Assistant:
{{ .Content }}</s>
{{ end }}{{ if .Prompt }}### User:
{{ continue }}
{{ .Prompt }}
{{- end }}
{{ .Content }}
{{ end }}### Assistant:
{{ end }}### Assistant:
{{ .Response }}</s>
template/starcoder2-instruct.gotmpl
View file @
9468c682
{{ if .System }}{{ .System }}
{{- $system := "" }}
{{- range .Messages }}
{{- if eq .Role "system" }}
{{- if not $system }}{{ $system = .Content }}
{{- else }}{{ $system = printf "%s\n\n%s" $system .Content }}
{{- end }}
{{- else if eq .Role "user" }}
{{- if $system }}{{ $system }}
{{ end }}{{ if .Prompt }}### Instruction
{{ $system = "" }}
{{ .Prompt }}
{{- end }}### Instruction
{{ .Content }}
{{ e
nd
}}### Response
{{ e
lse if eq .Role "assistant"
}}### Response
{{ .
Response
}}<|endoftext|>
{{ .
Content
}}<|endoftext|>
{{ end }}
{{- end }}### Response
template/vicuna.gotmpl
View file @
9468c682
{{ if .System }}{{ .System }}
{{- $system := "" }}
{{- range .Messages }}
{{- if eq .Role "system" }}
{{- if not $system }}{{ $system = .Content }}
{{- else }}{{ $system = printf "%s\n\n%s" $system .Content }}
{{- end }}
{{- else if eq .Role "user" }}
{{- if $system }}{{ $system }}
{{ end }}{{ if .Prompt }}USER: {{ .Prompt }}
{{ $system = "" }}
{{ end }}ASSISTANT: {{ .Response }}</s>
{{- end }}USER: {{ .Content }}
{{ else if eq .Role "assistant" }}ASSISTANT: {{ .Content }}</s>
{{ end }}
{{- end }}ASSISTANT:
\ No newline at end of file
template/zephyr.gotmpl
View file @
9468c682
{{ if .System }}<|system|>
{{- range .Messages }}<|{{ .Role }}|>
{{ .System }}</s>
{{ .Content }}</s>
{{ end }}{{ if .Prompt }}<|user|>
{{ .Prompt }}</s>
{{ end }}<|assistant|>
{{ end }}<|assistant|>
{{ .Response }}</s>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment