Download chat_template.jinja from webAI-Official/Echo-Air: direct link, hf CLI and curl.
- Browser
- Download file 1.51 kB
-
https://huggingface.co/webAI-Official/Echo-Air/resolve/main/chat_template.jinja
- Command line
-
hf download hf://webAI-Official/Echo-Air/chat_template.jinja
-
curl -L -o chat_template.jinja https://huggingface.co/webAI-Official/Echo-Air/resolve/main/chat_template.jinja
1.51 kB
| {%- set training = messages | length == 2 -%} | |
| {%- if messages | length > 2 or messages[0]['role'] != 'user' or (training and messages[1]['role'] != 'assistant') -%} | |
| {{- raise_exception('Gradium Phonon TTS takes one `user` message per conversation, followed by the `assistant` target audio to train on.') -}} | |
| {%- endif -%} | |
| {%- if training -%} | |
| {%- set target = messages[1]['content'] -%} | |
| {%- if target is string or target | length != 1 or target[0]['type'] != 'audio' -%} | |
| {{- raise_exception('The `assistant` turn holds one `audio` item, the target.') -}} | |
| {%- endif -%} | |
| {%- endif -%} | |
| {%- set content = messages[0]['content'] -%} | |
| {%- if content is string -%} | |
| {%- set texts = [content] -%} | |
| {%- set num_audio = 0 -%} | |
| {%- else -%} | |
| {%- set texts = content | selectattr('type', 'equalto', 'text') | map(attribute='text') | list -%} | |
| {%- set num_audio = content | selectattr('type', 'equalto', 'audio') | list | length -%} | |
| {%- endif -%} | |
| {%- if texts | length > 1 or (texts | length == 0 and not training) or num_audio > 1 -%} | |
| {{- raise_exception('The `user` turn holds one `text` item and at most one `audio` item (the voice).') -}} | |
| {%- endif -%} | |
| {%- set voice = '<|audio_prompt|>' if num_audio else '' -%} | |
| {%- set text = (texts[0] if texts else '') | trim -%} | |
| {%- if training -%} | |
| {{- voice ~ text ~ '<|audio_bos|><|audio_prompt|>' -}} | |
| {%- else -%} | |
| {{- voice ~ text -}} | |
| {%- if add_generation_prompt -%} | |
| {{- '<|audio_bos|>' -}} | |
| {%- endif -%} | |
| {%- endif -%} | |