Image-Text-to-Text
Transformers
ONNX
Safetensors
English
idefics3
conversational

Run this model with HF Jobs

Run HuggingFaceTB/SmolVLM-Instruct on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs and TRL to fine-tune https://huggingface.co/HuggingFaceTB/SmolVLM-Instruct. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/HuggingFaceTB/SmolVLM-Instruct on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/HuggingFaceTB/SmolVLM-Instruct. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Chat template: render string `content` instead of dropping it

#37
by arjhinety - opened

Same change as SmolVLM2-2.2B-Instruct#32, which was merged; context in transformers#50613.

If a message's content is a string rather than a list of typed parts, the chat template drops its text without an error, so a string system prompt renders as System: <end_of_utterance>. This PR adds a string branch before the existing list handling, in chat_template.json and tokenizer_config.json (they hold the same template, identical to the one changed there):

-{{message['role'] | capitalize}}{% if message['content'][0]['type'] == 'image' %}{{':'}}{% else %}{{': '}}{% endif %}{% for line in message['content'] %}{% if line['type'] == 'text' %}{{line['text']}}{% elif line['type'] == 'image' %}{{ '<image>' }}{% endif %}{% endfor %}<end_of_utterance>
+{{message['role'] | capitalize}}{% if message['content'] is string %}{{': ' + message['content']}}{% else %}{% if message['content'][0]['type'] == 'image' %}{{':'}}{% else %}{{': '}}{% endif %}{% for line in message['content'] %}{% if line['type'] == 'text' %}{{line['text']}}{% elif line['type'] == 'image' %}{{ '<image>' }}{% endif %}{% endfor %}{% endif %}<end_of_utterance>

Checked with transformers 5.22.2 by loading this repo's files with the patched templates. Through AutoProcessor, a string system prompt now renders as System: Be brief., the same as [{"type": "text", "text": "Be brief."}], and list-content output is unchanged (text only, image first, text then image, two images, multi-turn; with and without add_generation_prompt). Through AutoTokenizer, a string user turn renders like the typed-part form. I haven't tested other template engines.

Written with help from an AI coding assistant, which made the change and ran the checks. I reviewed the diff and the check output.

RaushanTurganbay changed pull request status to merged

Sign up or log in to comment