Unsloth finetune of gemma 3

vision

343 4 weeks ago

ee4013b7cd9b · 994B
{{- range $index, $message := .Messages -}}
{{- /* Skip the system message if it's the first message, mirroring Jinja2's logic */ -}}
{{- if ne $message.Role "system" -}}
{{- /* Map 'assistant' role to 'model' as in the original */ -}}
{{- $role := $message.Role -}}
{{- if eq $message.Role "assistant" -}}
{{- $role = "model" -}}
{{- end -}}
{{- /* Handle the first user message after a system message by prepending system content */ -}}
{{- if and (eq $index 1) (eq (index $.Messages 0).Role "system") (eq $role "user") -}}
<start_of_turn>{{ $role }}
{{- /* Prepend the system message content with two newlines, assuming it's a string in Ollama */ -}}
{{ (index $.Messages 0).Content }}
{{ $message.Content }}<end_of_turn>
{{- else -}}
<start_of_turn>{{ $role }}
{{ $message.Content }}<end_of_turn>
{{- end -}}
{{- end -}}
{{- end -}}
{{- /* Add the generation prompt at the end, as in the original when add_generation_prompt is true */ -}}
<start_of_turn>model