Image-Text-to-Text
Transformers
Safetensors
English
idefics3
multimodal
vision
conversational

Run this model with HF Jobs

Run HuggingFaceM4/Idefics3-8B-Llama3 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/HuggingFaceM4/Idefics3-8B-Llama3. 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/HuggingFaceM4/Idefics3-8B-Llama3 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/HuggingFaceM4/Idefics3-8B-Llama3. 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.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/HuggingFaceM4/Idefics3-8B-Llama3. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.

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

#27
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 template in chat_template.json (the one AutoProcessor uses) 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:

-{{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>

tokenizer_config.json is not changed: it holds a different, Llama-3-style text template that already accepts string content.

Checked with transformers 5.22.2 by loading this repo's files with the patched chat_template.json 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). The tokenizer's template is byte-identical before and after. 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.

cant merge this one, no write access to org so lets see if someone else will merge 👀

Salut

Ready to merge
This branch is ready to get merged automatically.

Sign up or log in to comment