File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -76,3 +76,19 @@ Create the name of the service account to use
7676{ {- default " default" .Values.serviceAccount.name } }
7777{ {- end } }
7878{ {- end } }
79+
80+ { {/*
81+ Workaround for models which don' t yet contain chat templates in their HuggingFace repos.
82+ If a chat template is provided in the Helm values then this is used, otherwise we omit the
83+ chat template for all models apart from a list of known cases where the upstream repo is
84+ not responsive to adding a chat template to their repo.
85+ */}}
86+ {{- define "azimuth-llm.chatTemplate" -}}
87+ {{- if .Values.huggingface.chatTemplate }}
88+ - --chat-template
89+ - {{ quote .Values.huggingface.chatTemplate }}
90+ {{- else if contains "WizardCoder" .Values.huggingface.model }}
91+ - --chat-template
92+ - {{ quote "{% for message in messages %}{% if message[' role' ] == ' system' %}{% endif %}{% if message[' role' ] == ' user' %}{{ ' ### Instruction:\n' }}{% endif %}{% if message[' role' ] == ' assistant' %}{{ ' ### Response:\n' }}{% endif %}{{ message[' content' ].strip() }}{% if not loop.last %}{{ ' \n\n' }}{% endif %}{% if message[' role' ] == ' user' and loop.last %}{{ ' ### Response:\n' }}{% endif %}{% endfor %}" }}
93+ {{- end -}}
94+ {{- end }}
Original file line number Diff line number Diff line change 2828 args :
2929 - --model
3030 - {{ .Values.huggingface.model }}
31- {{- if .Values.huggingface.chatTemplate }}
32- - --chat-template
33- - {{ quote .Values.huggingface.chatTemplate }}
34- {{- end -}}
31+ {{- include "azimuth-llm.chatTemplate" . | nindent 10 }}
3532 {{- if .Values.api.extraArgs -}}
3633 {{- .Values.api.extraArgs | toYaml | nindent 10 }}
3734 {{- end -}}
You can’t perform that action at this time.
0 commit comments