ahmedheakl commited on
Commit
a2107ed
·
verified ·
1 Parent(s): 031be51

Update chat_template.json

Browse files
Files changed (1) hide show
  1. chat_template.json +1 -1
chat_template.json CHANGED
@@ -1,3 +1,3 @@
1
  {
2
- "chat_template": "{% if not add_generation_prompt is defined %}{% set add_generation_prompt = false %}{% endif %}{% set image_count = namespace(value=0) %}{% set video_count = namespace(value=0) %}{% set ns = namespace(system_prompt='') %}{%- for message in messages %}{%- if message['role'] == 'system' %}{% set ns.system_prompt = ns.system_prompt + message['content'] %}{%- endif %}{%- endfor %}<|begin▁of▁sentence|>{{ ns.system_prompt }}{%- for message in messages %}{%- if message['role'] == 'user' %}{%- if message['content'] is string %}{{ '<|User|>' + message['content'] }}{%- else %}{%- for content in message['content'] %}{%- if content['type'] == 'image' or 'image' in content or 'image_url' in content %}{% set image_count.value = image_count.value + 1 %}{%- if add_vision_id %}Picture {{ image_count.value }}:{%- endif %}<|vision_start|><|image_pad|><|vision_end|>{%- elif content['type'] == 'video' or 'video' in content %}{% set video_count.value = video_count.value + 1 %}{%- if add_vision_id %}Video {{ video_count.value }}:{%- endif %}<|vision_start|><|video_pad|><|vision_end|>{%- elif 'text' in content %}{{ '<|User|>' + content['text'] }}{%- endif %}{%- endfor %}{%- endif %}{%- elif message['role'] == 'assistant' %}{%- if message['content'] is string %}{{ '<|Assistant|>' + message['content'] + '<|end▁of▁sentence|>' }}{%- else %}{%- for content in message['content'] %}{%- if content['type'] == 'image' or 'image' in content or 'image_url' in content %}{% set image_count.value = image_count.value + 1 %}{%- if add_vision_id %}Picture {{ image_count.value }}:{%- endif %}<|vision_start|><|image_pad|><|vision_end|>{%- elif content['type'] == 'video' or 'video' in content %}{% set video_count.value = video_count.value + 1 %}{%- if add_vision_id %}Video {{ video_count.value }}:{%- endif %}<|vision_start|><|video_pad|><|vision_end|>{%- elif 'text' in content %}{{ '<|Assistant|>' + content['text'] + '<|end▁of▁sentence|>' }}{%- endif %}{%- endfor %}{%- endif %}{%- endif %}{%- endfor -%}{% if add_generation_prompt %}{{ '<|Assistant|><think>\\n' }}{% endif %}"
3
  }
 
1
  {
2
+ "chat_template": "{% if not add_generation_prompt is defined %}{% set add_generation_prompt = false %}{% endif %}{% set image_count = namespace(value=0) %}{% set video_count = namespace(value=0) %}{% set ns = namespace(system_prompt='') %}{% for message in messages %}{% if message['role'] == 'system' %}{% set ns.system_prompt = ns.system_prompt + message['content'] %}{% endif %}{% endfor %}<|begin_of_sentence|>{{ ns.system_prompt }}{% for message in messages %}{% if message['role'] == 'user' %}{% if message['content'] is string %}{{ '<|User|>' + message['content'] }}{% else %}{% for content in message['content'] %}{% if content['type'] == 'image' or 'image' in content or 'image_url' in content %}{% set image_count.value = image_count.value + 1 %}{% if add_vision_id %}Picture {{ image_count.value }}:{% endif %}<|vision_start|><|image_pad|><|vision_end|>{% elif content['type'] == 'video' or 'video' in content %}{% set video_count.value = video_count.value + 1 %}{% if add_vision_id %}Video {{ video_count.value }}:{% endif %}<|vision_start|><|video_pad|><|vision_end|>{% elif 'text' in content %}{{ '<|User|>' + content['text'] }}{% endif %}{% endfor %}{% endif %}{% elif message['role'] == 'assistant' %}{% if message['content'] is string %}{{ '<|Assistant|>' + message['content'] + '<|end_of_sentence|>' }}{% else %}{% for content in message['content'] %}{% if content['type'] == 'image' or 'image' in content or 'image_url' in content %}{% set image_count.value = image_count.value + 1 %}{% if add_vision_id %}Picture {{ image_count.value }}:{% endif %}<|vision_start|><|image_pad|><|vision_end|>{% elif content['type'] == 'video' or 'video' in content %}{% set video_count.value = video_count.value + 1 %}{% if add_vision_id %}Video {{ video_count.value }}:{% endif %}<|vision_start|><|video_pad|><|vision_end|>{% elif 'text' in content %}{{ '<|Assistant|>' + content['text'] + '<|end_of_sentence|>' }}{% endif %}{% endfor %}{% endif %}{% endif %}{% endfor %}{% if add_generation_prompt %}{{ '<|Assistant|><think>\\n' }}{% endif %}"
3
  }