North-Micro-Vision-Instruct-bf16 / chat_template.jinja
prince-canuma's picture
Upload MLX bf16 conversion
05423da verified
Raw
History Blame Contribute Delete
1.32 kB
{{ bos_token }}{%- for message in messages %}{%- if message.role == 'system' %}{{- '<|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>' }}{%- if message.content is string %}{{- message.content }}{%- else %}{%- for content in message.content %}{%- if 'text' in content %}{{- content.text }}{%- endif %}{%- endfor %}{%- endif %}{{- '<|END_OF_TURN_TOKEN|>' }}{%- elif message.role == 'user' %}{{- '<|START_OF_TURN_TOKEN|><|USER_TOKEN|>' }}{%- if message.content is string %}{{- message.content }}{%- else %}{%- for content in message.content %}{%- if content.type == 'image' or 'image' in content or 'image_url' in content %}<|VISION_START|><|IMAGE_PAD|><|VISION_END|>{%- elif content.type == 'video' or 'video' in content %}<|VISION_START|><|VIDEO_PAD|><|VISION_END|>{%- elif 'text' in content %}{{- content.text }}{%- endif %}{%- endfor %}{%- endif %}{{- '<|END_OF_TURN_TOKEN|>' }}{%- elif message.role == 'assistant' or message.role == 'chatbot' %}{{- '<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>' }}{%- if message.content is string %}{{- message.content }}{%- else %}{%- for content in message.content %}{%- if 'text' in content %}{{- content.text }}{%- endif %}{%- endfor %}{%- endif %}{{- '<|END_OF_TURN_TOKEN|>' }}{%- endif %}{%- endfor %}{%- if add_generation_prompt %}{{- '<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>' }}{%- endif %}