ChatWaifu_2.0_vision_deprecated / chat_template.json
spow12's picture
Upload processor
9201a63 verified
raw
history blame
1.85 kB
{
"chat_template": "{{ bos_token -}}\n{% if not add_generation_prompt is defined -%}\n {% set add_generation_prompt = false -%}\n{% endif -%}\n\n{%- for message in messages %}\n {%- if message[\"role\"] == \"system\" %}\n {{- \"[INST]\" }}\n {%- if message[\"content\"] is not string %}\n {%- for chunk in message[\"content\"] %}\n {%- if chunk[\"type\"] == \"text\" %}\n {{- chunk[\"content\"] }}\n {%- elif chunk[\"type\"] == \"image\" %}\n {{- \"[IMG]\" }}\n {%- endif %}\n {%- endfor %}\n {%- else %}\n {{- message[\"content\"] }}\n {%- endif %}\n {{- \"[/INST]\" + eos_token }}\n {%- elif message[\"role\"] == \"user\" %}\n {{- \"[INST]\" }}\n {%- if message[\"content\"] is not string %}\n {%- for chunk in message[\"content\"] %}\n {%- if chunk[\"type\"] == \"text\" %}\n {{- chunk[\"content\"] }}\n {%- elif chunk[\"type\"] == \"image\" %}\n {{- \"[IMG]\" }}\n {%- endif %}\n {%- endfor %}\n {%- else %}\n {{- message[\"content\"] }}\n {%- endif %}\n {{- \"[/INST]\" }}\n {%- elif message[\"role\"] == \"assistant\" %}\n {%- if message[\"content\"] is not string %}\n {%- for chunk in message[\"content\"] %}\n {%- if chunk[\"type\"] == \"text\" %}\n {{- chunk[\"content\"] }}\n {%- elif chunk[\"type\"] == \"image\" %}\n {{- \"[IMG]\" }}\n {%- endif %}\n {%- endfor %}\n {%- else %}\n {{- message[\"content\"] }}\n {%- endif %}\n {{- eos_token }}\n {%- endif %}\n{%- endfor %}"
}