Browse Source

update embedded templates

Michael Yang 9 months ago
parent
commit
19753c18c0

+ 2 - 2
template/alfred.gotmpl

@@ -3,6 +3,6 @@
 {{- end }}
 {{- range .Messages }}<start_{{ .Role }}>{{ .Content }}<end_message>
 {{- end }}<start_assistant>
-{{- else }}
+{{- else -}}
 {{ if .System }}<start_system>{{ .System }}<end_message>{{ end }}{{ if .Prompt }}<start_user>{{ .Prompt }}<end_message>{{ end }}<start_assistant>{{ .Response }}<end_message>
-{{- end }}
+{{- end -}}

+ 5 - 3
template/alpaca.gotmpl

@@ -1,6 +1,7 @@
 {{- if .Messages }}
 {{- if .System }}{{ .System }}
-{{- end }}
+
+{{ end }}
 {{- range .Messages }}
 {{- if eq .Role "user" }}### Instruction:
 {{- else if eq .Role "assistant" }}### Response:
@@ -8,7 +9,7 @@
 {{ .Content }}
 
 {{ end }}### Response:
-{{ else }}
+{{ else -}}
 {{ if .System }}{{ .System }}
 
 {{ end }}{{ if .Prompt }}### Instruction:
@@ -16,4 +17,5 @@
 
 {{ end }}### Response:
 {{ .Response }}
-{{- end }}
+
+{{ end -}}

+ 2 - 2
template/chatml.gotmpl

@@ -5,11 +5,11 @@
 {{- range .Messages }}<|im_start|>{{ .Role }}
 {{ .Content }}<|im_end|>
 {{ end }}<|im_start|>assistant
-{{ else }}
+{{ else -}}
 {{ if .System }}<|im_start|>system
 {{ .System }}<|im_end|>
 {{ end }}{{ if .Prompt }}<|im_start|>user
 {{ .Prompt }}<|im_end|>
 {{ end }}<|im_start|>assistant
 {{ .Response }}<|im_end|>
-{{- end }}
+{{ end -}}

+ 4 - 3
template/chatqa.gotmpl

@@ -8,10 +8,11 @@
 {{- end }} {{ .Content }}
 
 {{ end }}Assistant:
-{{- else }}
+{{- else -}}
 {{ if .System }}System: {{ .System }}
 
 {{ end }}{{ if .Prompt }}User: {{ .Prompt }}
 
-{{ end }}Assistant: <|begin_of_text|>{{ .Response }}
-{{- end }}
+{{ end }}Assistant: {{ .Response }}
+
+{{ end -}}

+ 5 - 5
template/codellama-70b-instruct.gotmpl

@@ -7,13 +7,13 @@
  {{ .Content }} <step> {{ end }}Source: assistant
 Destination: user
 
-{{ else }}
-{{ if .System }} Source: system
+ {{ else -}}
+{{ if .System }}Source: system
 
- {{ .System }} <step>{{ end }} Source: user
+ {{ .System }} <step> {{ end }}Source: user
 
  {{ .Prompt }} <step> Source: assistant
 Destination: user
 
- {{ .Response }}<step>
-{{- end }}
+ {{ .Response }} <step>
+{{- end -}}

+ 7 - 5
template/falcon-instruct.gotmpl

@@ -6,8 +6,10 @@
 {{ else if eq .Role "assistant" }}Falcon:
 {{ end }}{{ .Content }}
 {{ end }}Falcon:
-{{ else }}
-{{ if .System }}{{ .System }}
-{{ end }}{{ if .Prompt }}User: {{ .Prompt }}
-{{ end }}Assistant: {{ .Response }}
-{{- end }}
+{{ else -}}
+{{ if .System }}System: {{ .System }}
+{{ end }}{{ if .Prompt }}User:
+{{ .Prompt }}
+{{ end }}Falcon:
+{{ .Response }}
+{{ end -}}

+ 4 - 3
template/gemma-instruct.gotmpl

@@ -8,9 +8,10 @@
 {{- end }}
 {{ .Content }}<end_of_turn>
 {{ end }}<start_of_turn>model
-{{ else }}
+{{ else -}}
 <start_of_turn>user
-{{ if .System }}{{ .System }} {{ end }}{{ .Prompt }}<end_of_turn>
+{{ if .System }}{{ .System }}
+{{ end }}{{ .Prompt }}<end_of_turn>
 <start_of_turn>model
 {{ .Response }}<end_of_turn>
-{{- end }}
+{{ end -}}

+ 4 - 4
template/granite-instruct.gotmpl

@@ -10,9 +10,8 @@
 {{ .Content }}
 
 {{ end }}Answer:
-{{ else }}
-{{ if .System }}
-System:
+{{ else -}}
+{{ if .System }}System:
 {{ .System }}
 
 {{ end }}{{ if .Prompt }}Question:
@@ -20,4 +19,5 @@ System:
 
 {{ end }}Answer:
 {{ .Response }}
-{{- end }}
+
+{{ end -}}

+ 4 - 4
template/llama2-chat.gotmpl

@@ -9,8 +9,8 @@
 {{- else }} [/INST] {{ .Content }}</s><s>
 {{- end }}
 {{- end }} [/INST]
-{{- else }}
-[INST] <<SYS>>{{ .System }}<</SYS>>
+{{- else -}}
+[INST] <<SYS>>{{ if .System }}{{ .System }}{{ end }}<</SYS>>
 
-{{ .Prompt }} [/INST] {{ .Response }}
-{{- end }}
+{{ .Prompt }} [/INST] {{ .Response }}</s>
+{{- end -}}

+ 2 - 2
template/llama3-instruct.gotmpl

@@ -8,7 +8,7 @@
 {{ .Content }}<|eot_id|>
 {{- end }}<|start_header_id|>assistant<|end_header_id|>
 
-{{ else }}
+{{ else -}}
 {{ if .System }}<|start_header_id|>system<|end_header_id|>
 
 {{ .System }}<|eot_id|>{{ end }}{{ if .Prompt }}<|start_header_id|>user<|end_header_id|>
@@ -16,4 +16,4 @@
 {{ .Prompt }}<|eot_id|>{{ end }}<|start_header_id|>assistant<|end_header_id|>
 
 {{ .Response }}<|eot_id|>
-{{- end }}
+{{- end -}}

+ 3 - 2
template/magicoder.gotmpl

@@ -9,7 +9,7 @@
 {{ .Content }}
 
 {{ end }}@@ Response
-{{ else }}
+{{ else -}}
 {{ if .System }}{{ .System }}
 
 {{ end }}{{ if .Prompt }}@@ Instruction
@@ -17,4 +17,5 @@
 
 {{ end }}@@ Response
 {{ .Response }}
-{{- end }}
+
+{{ end -}}

+ 3 - 2
template/mistral-instruct.gotmpl

@@ -5,5 +5,6 @@
 {{- else if eq .Role "assistant" }}[/INST] {{ .Content }}</s>
 {{- end }}
 {{- end }}[/INST]
-{{- else }}[INST] {{ if .System }}{{ .System }} {{ end }}{{ .Prompt }} [/INST] {{ .Response }}
-{{- end }}
+{{- else -}}
+[INST] {{ if .System }}{{ .System }} {{ end }}{{ .Prompt }}[/INST] {{ .Response }}</s>
+{{- end -}}

+ 6 - 6
template/openchat.gotmpl

@@ -1,11 +1,11 @@
 {{- if .Messages }}
-{{- if .System }}GPT Correct System: {{ .System }}<|end_of_turn|>
+{{- if .System }}GPT4 Correct System: {{ .System }}<|end_of_turn|>
 {{- end }}
-{{- range .Messages }}GPT Correct
+{{- range .Messages }}GPT4 Correct
 {{- if eq .Role "user" }} User:
 {{- else if eq .Role "assistant" }} Assistant:
 {{- end }} {{ .Content }}<|end_of_turn|>
-{{- end }}GPT Correct Assistant:
-{{- else }}
-{{ .System }}<|end_of_turn|>GPT4 Correct User: {{ .Prompt }}<|end_of_turn|>GPT4 Correct Assistant: {{ .Response }}<|end_of_turn|>
-{{- end }}
+{{- end }}GPT4 Correct Assistant:
+{{- else -}}
+{{ if .System }}GPT4 Correct System: {{ .System }}<|end_of_turn|>{{ end }}GPT4 Correct User: {{ .Prompt }}<|end_of_turn|>GPT4 Correct Assistant: {{ .Response }}<|end_of_turn|>
+{{- end -}}

+ 2 - 2
template/phi-3.gotmpl

@@ -5,11 +5,11 @@
 {{- range .Messages }}<|{{ .Role }}|>
 {{ .Content }}<|end|>
 {{ end }}<|assistant|>
-{{ else }}
+{{ else -}}
 {{ if .System }}<|system|>
 {{ .System }}<|end|>
 {{ end }}{{ if .Prompt }}<|user|>
 {{ .Prompt }}<|end|>
 {{ end }}<|assistant|>
 {{ .Response }}<|end|>
-{{- end }}
+{{ end -}}

+ 4 - 3
template/solar-instruct.gotmpl

@@ -10,7 +10,7 @@
 {{ .Content }}</s>
 {{ end }}
 {{ end }}### Assistant:
-{{ else }}
+{{ else -}}
 {{ if .System }}### System:
 {{ .System }}
 
@@ -18,5 +18,6 @@
 {{ .Prompt }}
 
 {{ end }}### Assistant:
-{{ .Response }}
-{{- end }}
+{{ .Response }}</s>
+
+{{ end -}}

+ 2 - 3
template/starcoder2-instruct.gotmpl

@@ -11,14 +11,13 @@
 
 {{ end }}
 {{- end }}### Response
-{{ else }}
+{{ else -}}
 {{ if .System }}{{ .System }}
 
 {{ end }}{{ if .Prompt }}### Instruction
 {{ .Prompt }}
 
-
 {{ end }}### Response
 {{ .Response }}<|endoftext|>
 
-{{- end }}
+{{ end -}}

+ 3 - 1
template/testdata/alpaca.gotmpl/system-user-assistant-user

@@ -1,4 +1,6 @@
-You are a helpful assistant.### Instruction:
+You are a helpful assistant.
+
+### Instruction:
 Hello, how are you?
 
 ### Response:

+ 1 - 0
template/testdata/codellama-70b-instruct.gotmpl/system-user-assistant-user

@@ -9,3 +9,4 @@ Source: system
  I'd like to show off how chat templating works! <step> Source: assistant
 Destination: user
 
+ 

+ 1 - 0
template/testdata/codellama-70b-instruct.gotmpl/user

@@ -3,3 +3,4 @@ Source: user
  Hello, how are you? <step> Source: assistant
 Destination: user
 
+ 

+ 1 - 0
template/testdata/codellama-70b-instruct.gotmpl/user-assistant-user

@@ -7,3 +7,4 @@ Source: user
  I'd like to show off how chat templating works! <step> Source: assistant
 Destination: user
 
+ 

+ 1 - 1
template/testdata/openchat.gotmpl/system-user-assistant-user

@@ -1 +1 @@
-GPT Correct System: You are a helpful assistant.<|end_of_turn|>GPT Correct User: Hello, how are you?<|end_of_turn|>GPT Correct Assistant: I'm doing great. How can I help you today?<|end_of_turn|>GPT Correct User: I'd like to show off how chat templating works!<|end_of_turn|>GPT Correct Assistant:
+GPT4 Correct System: You are a helpful assistant.<|end_of_turn|>GPT4 Correct User: Hello, how are you?<|end_of_turn|>GPT4 Correct Assistant: I'm doing great. How can I help you today?<|end_of_turn|>GPT4 Correct User: I'd like to show off how chat templating works!<|end_of_turn|>GPT4 Correct Assistant:

+ 1 - 1
template/testdata/openchat.gotmpl/user

@@ -1 +1 @@
-GPT Correct User: Hello, how are you?<|end_of_turn|>GPT Correct Assistant:
+GPT4 Correct User: Hello, how are you?<|end_of_turn|>GPT4 Correct Assistant:

+ 1 - 1
template/testdata/openchat.gotmpl/user-assistant-user

@@ -1 +1 @@
-GPT Correct User: Hello, how are you?<|end_of_turn|>GPT Correct Assistant: I'm doing great. How can I help you today?<|end_of_turn|>GPT Correct User: I'd like to show off how chat templating works!<|end_of_turn|>GPT Correct Assistant:
+GPT4 Correct User: Hello, how are you?<|end_of_turn|>GPT4 Correct Assistant: I'm doing great. How can I help you today?<|end_of_turn|>GPT4 Correct User: I'd like to show off how chat templating works!<|end_of_turn|>GPT4 Correct Assistant:

+ 4 - 3
template/vicuna.gotmpl

@@ -7,8 +7,9 @@
 {{ else if eq .Role "assistant" }}ASSISTANT: {{ .Content }}</s>
 {{ end }}
 {{- end }}ASSISTANT:
-{{- else }}
+{{- else -}}
 {{ if .System }}{{ .System }}
+
 {{ end }}{{ if .Prompt }}USER: {{ .Prompt }}
-{{ end }}ASSISTANT: {{ .Response }}
-{{- end }}
+{{ end }}ASSISTANT: {{ .Response }}</s>
+{{ end -}}

+ 2 - 2
template/zephyr.gotmpl

@@ -5,11 +5,11 @@
 {{- range .Messages }}<|{{ .Role }}|>
 {{ .Content }}</s>
 {{ end }}<|assistant|>
-{{ else }}
+{{ else -}}
 {{ if .System }}<|system|>
 {{ .System }}</s>
 {{ end }}{{ if .Prompt }}<|user|>
 {{ .Prompt }}</s>
 {{ end }}<|assistant|>
 {{ .Response }}</s>
-{{- end }}
+{{ end -}}