Run this model with HF Jobs
Run trl-internal-testing/tiny-Mistral3ForConditionalGeneration 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/trl-internal-testing/tiny-Mistral3ForConditionalGeneration. 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/trl-internal-testing/tiny-Mistral3ForConditionalGeneration 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/trl-internal-testing/tiny-Mistral3ForConditionalGeneration. 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/trl-internal-testing/tiny-Mistral3ForConditionalGeneration. 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.
Instructions to use trl-internal-testing/tiny-Mistral3ForConditionalGeneration with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use trl-internal-testing/tiny-Mistral3ForConditionalGeneration with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="trl-internal-testing/tiny-Mistral3ForConditionalGeneration") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("trl-internal-testing/tiny-Mistral3ForConditionalGeneration") model = AutoModelForMultimodalLM.from_pretrained("trl-internal-testing/tiny-Mistral3ForConditionalGeneration", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use trl-internal-testing/tiny-Mistral3ForConditionalGeneration with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "trl-internal-testing/tiny-Mistral3ForConditionalGeneration" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "trl-internal-testing/tiny-Mistral3ForConditionalGeneration", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/trl-internal-testing/tiny-Mistral3ForConditionalGeneration
- SGLang
How to use trl-internal-testing/tiny-Mistral3ForConditionalGeneration with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "trl-internal-testing/tiny-Mistral3ForConditionalGeneration" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "trl-internal-testing/tiny-Mistral3ForConditionalGeneration", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "trl-internal-testing/tiny-Mistral3ForConditionalGeneration" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "trl-internal-testing/tiny-Mistral3ForConditionalGeneration", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use trl-internal-testing/tiny-Mistral3ForConditionalGeneration with Docker Model Runner:
docker model run hf.co/trl-internal-testing/tiny-Mistral3ForConditionalGeneration
Upload Mistral3ForConditionalGeneration
#3
by albertvillanova HF Staff - opened
Files changed (4)
- chat_template.jinja+71-25
- config.json+3-3
- model.safetensors+2-2
- tokenizer_config.json+39
1234567891011121314151617181920212223245252627282930113132333419 unmodified lines545556575859606162636465666768394069707172732 unmodified lines7677787980818283848549868788891 unmodified line919293579495969798991001011024 unmodified lines107108109686911011111211311473115116117118771191201211221 unmodified line1241251261271281291301311 unmodified line1331341359213613713813917 unmodified lines15715815911616016116216316412116516616716841 unmodified lines2102112121691702132142152162171 unmodified line21922022117822222322422518222622722822918623023123223319023423523623721 unmodified lines2592602612182622632642652662672682692702712722282732742752766 unmodified lines283284285241286287288289290291292293294295250296297298299300301256302303304305306261307308309{#- Default system message if no system prompt is passed. #}{#- Dates for the default system prompt, filled as in the model card's load_system_prompt(). #}{%- set today = strftime_now("%Y-%m-%d") %}{%- set date_parts = namespace(year=today[:4]|int, month=today[5:7]|int, day=today[8:10]|int) %}{%- if date_parts.day > 1 %} {%- set date_parts.day = date_parts.day - 1 %}{%- else %} {%- if date_parts.month == 1 %} {%- set date_parts.month = 12 %} {%- set date_parts.year = date_parts.year - 1 %} {%- else %} {%- set date_parts.month = date_parts.month - 1 %} {%- endif %} {%- if date_parts.month == 2 %} {%- set leap = date_parts.year % 4 == 0 and (date_parts.year % 100 != 0 or date_parts.year % 400 == 0) %} {%- set date_parts.day = 29 if leap else 28 %} {%- else %} {%- set date_parts.day = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][date_parts.month - 1] %} {%- endif %}{%- endif %}{%- set yesterday = date_parts.year|string + '-' + ('0' if date_parts.month < 10 else '') + date_parts.month|string + '-' + ('0' if date_parts.day < 10 else '') + date_parts.day|string %}{%- set default_system_message = 'You are Mistral Medium 3.5, a Large Language Model (LLM) created by Mistral AI, a French startup headquartered in Paris.You are an intelligent conversational assistant powering an AI assistant called Le Chat.Your knowledge base was last updated on Friday, November 1, 2024.The current date is {today}.The current date is ' ~ today ~ '.
# GENERAL GUIDELINES
- Accurately answer the user\'s question.- For uncertain information or when the user\'s request requires up-to-date or specific data, use the available tools to fetch the information.- Be very attentive to dates, always try to resolve dates (e.g. "yesterday" is {yesterday}) and when asked about information at specific dates, discard information that is at another date.- Be very attentive to dates, always try to resolve dates (e.g. "yesterday" is ' ~ yesterday ~ ') and when asked about information at specific dates, discard information that is at another date.
# WEB BROWSING INSTRUCTIONS
19 unmodified lines{{- bos_token }}
{#- Reject an empty conversation, as the tokenizer does. #}{%- if messages | length == 0 %} {{- raise_exception('Conversation must have at least one message') }}{%- endif %}
{#- A single message must be a user or system message, as the tokenizer requires. #}{%- if messages | length == 1 and messages[0]['role'] not in ['user', 'system', 'developer'] %} {{- raise_exception('Conversation must start with a user message or system message') }}{%- endif %}
{#- Handle system prompt if it exists. #}{%- set loop_messages = messages %}{%- if messages[0]['role'] != 'system' and default_system_message != '' %} {{- '[SYSTEM_PROMPT]' + default_system_message + '[/SYSTEM_PROMPT]' }}{%- if messages[0]['role'] not in ['system', 'developer'] and default_system_message != '' %} {{- '[SYSTEM_PROMPT]' ~ default_system_message ~ '[/SYSTEM_PROMPT]' }}{%- endif %}
2 unmodified lines{%- set has_tools = false %}{%- if tools is defined and tools is not none and tools|length > 0 %} {%- set has_tools = true %} {%- set ns_t = namespace(tools=[]) %} {%- for tool in tools %} {%- set tool_function = tool['function'] %} {%- set description = tool_function['description'] if 'description' in tool_function else none %} {%- set parameters = tool_function['parameters'] if 'parameters' in tool_function else none %} {%- set ns_t.tools = ns_t.tools + [{'type': tool['type'] if 'type' in tool else 'function', 'function': {'name': tool_function['name'], 'description': description if description is not none else '', 'parameters': parameters if parameters is not none else {}}}] %} {%- endfor %} {%- set available_tools = '[AVAILABLE_TOOLS]' + (tools| tojson) + '[/AVAILABLE_TOOLS]' %} {%- set available_tools = '[AVAILABLE_TOOLS]' ~ (ns_t.tools| tojson) ~ '[/AVAILABLE_TOOLS]' %}{%- endif %}{%- if reasoning_effort is not defined or reasoning_effort is none %} {%- set reasoning_effort = 'none' %}1 unmodified line{%- if reasoning_effort not in ['none', 'high'] %} {{- raise_exception('reasoning_effort must be either "none" or "high"') }}{%- endif %}{%- set model_settings = '[MODEL_SETTINGS]{"reasoning_effort": "' + reasoning_effort + '"}[/MODEL_SETTINGS]' %}{%- set model_settings_parts = [] %}{%- set model_settings_parts = model_settings_parts + ['"reasoning_effort": "' ~ reasoning_effort ~ '"'] %}{%- set model_settings = '' %}{%- if model_settings_parts %} {%- set model_settings = '[MODEL_SETTINGS]{' ~ model_settings_parts|join(', ') ~ '}[/MODEL_SETTINGS]' %}{%- endif %}
{#- Macros #}{%- macro render_content(content, context_name, supported_types_desc, support_thinking, support_images) -%}4 unmodified lines {%- if block['type'] == 'text' -%} {{- block['text'] -}} {%- elif support_thinking and block['type'] == 'thinking' -%} {{- '[THINK]' + block['thinking'] -}} {%- if block.get('closed', true) -%}{{- '[/THINK]' -}}{%- endif -%} {{- '[THINK]' ~ block['thinking'] -}} {%- if (block['closed'] if 'closed' in block else true) -%}{{- '[/THINK]' -}}{%- endif -%} {%- elif support_images and block['type'] in ['image', 'image_url'] -%} {{- '[IMG]' -}} {%- else -%} {{- raise_exception('Only ' + supported_types_desc + ' chunks are supported in ' + context_name + '.') -}} {{- raise_exception('Only ' ~ supported_types_desc ~ ' chunks are supported in ' ~ context_name ~ '.') -}} {%- endif -%} {%- endfor -%} {%- else -%} {{- raise_exception(context_name + ' must have non-empty content.') -}} {{- raise_exception(context_name ~ ' must have non-empty content.') -}} {%- endif -%}{%- endmacro -%}
1 unmodified line{#- A sentinel message is appended so the last group gets flushed inside the loop. #}{%- set ns_agg = namespace(messages=[], current_group=[], current_role=none) %}{%- for message in loop_messages + [{'role': '__sentinel__'}] %} {#- Read the developer role as system, as the tokenizer does. #} {%- set message = {'role': 'system', 'content': message['content']} if message['role'] == 'developer' else message %} {%- if message['role'] != ns_agg.current_role or message['role'] == 'system' or message['role'] == 'tool' %} {%- if ns_agg.current_role == 'tool' %} {%- set ns_agg.messages = ns_agg.messages + ns_agg.current_group %}1 unmodified line {%- set ns_c = namespace(text_parts=[], chunks=[], has_non_text=false, tool_calls=[]) %} {%- for msg in ns_agg.current_group %} {#- Convert reasoning / reasoning_content to a leading thinking chunk. #} {%- set reasoning = msg.get('reasoning_content', msg.get('reasoning', none)) %} {%- set reasoning = msg['reasoning_content'] if 'reasoning_content' in msg else (msg['reasoning'] if 'reasoning' in msg else none) %} {%- if reasoning is not none and reasoning != '' %} {%- if msg['content'] is not none and msg['content'] is not string %} {%- for block in msg['content'] %}17 unmodified lines {%- endif %} {%- endif %} {%- if msg['content'] is string %} {%- set ns_c.text_parts = ns_c.text_parts + [msg['content']] %} {%- set ns_c.text_parts = ns_c.text_parts + ([msg['content']] if msg['content'] else []) %} {%- elif msg['content'] is not none %} {%- set ns_msg = namespace(msg_text_parts=[]) %} {%- for block in msg['content'] %} {%- if block['type'] == 'text' %} {%- set ns_msg.msg_text_parts = ns_msg.msg_text_parts + [block['text']] %} {%- set ns_msg.msg_text_parts = ns_msg.msg_text_parts + ([block['text']] if block['text'] else []) %} {%- else %} {%- if ns_msg.msg_text_parts | length > 0 %} {%- set ns_c.text_parts = ns_c.text_parts + [ns_msg.msg_text_parts | join('')] %}41 unmodified lines
{#- Validates message ordering. #}{%- set ns = namespace(available_tools_and_settings_emitted=false) %}{%- if loop_messages | length > 0 and loop_messages[0]['role'] not in ['user', 'system'] %} {{- raise_exception('Conversation must start with a user or system message, got ' + loop_messages[0]['role'] + '.') }}{%- if loop_messages | length > 0 and loop_messages[0]['role'] not in ['user', 'system', 'assistant'] %} {{- raise_exception('Conversation must start with a user, system or assistant message, got ' ~ loop_messages[0]['role'] ~ '.') }}{%- endif %}{%- set ns_order = namespace(previous_role=none) %}{%- for message in loop_messages %}1 unmodified line {%- if ns_order.previous_role is not none %} {%- if ns_order.previous_role == 'system' %} {%- if current_role not in ['user', 'assistant', 'system'] %} {{- raise_exception('Unexpected role \'' + current_role + '\' after role \'' + ns_order.previous_role + '\'') }} {{- raise_exception('Unexpected role \'' ~ current_role ~ '\' after role \'' ~ ns_order.previous_role ~ '\'') }} {%- endif %} {%- elif ns_order.previous_role == 'user' %} {%- if current_role not in ['assistant', 'system', 'user'] %} {{- raise_exception('Unexpected role \'' + current_role + '\' after role \'' + ns_order.previous_role + '\'') }} {{- raise_exception('Unexpected role \'' ~ current_role ~ '\' after role \'' ~ ns_order.previous_role ~ '\'') }} {%- endif %} {%- elif ns_order.previous_role == 'assistant' %} {%- if current_role not in ['assistant', 'user', 'tool'] %} {{- raise_exception('Unexpected role \'' + current_role + '\' after role \'' + ns_order.previous_role + '\'') }} {{- raise_exception('Unexpected role \'' ~ current_role ~ '\' after role \'' ~ ns_order.previous_role ~ '\'') }} {%- endif %} {%- elif ns_order.previous_role == 'tool' %} {%- if current_role not in ['assistant', 'tool', 'user'] %} {{- raise_exception('Unexpected role \'' + current_role + '\' after role \'' + ns_order.previous_role + '\'') }} {{- raise_exception('Unexpected role \'' ~ current_role ~ '\' after role \'' ~ ns_order.previous_role ~ '\'') }} {%- endif %} {%- endif %} {%- endif %}21 unmodified lines {%- set user_content = message['content'] %} {%- endif %} {{- '[INST]' -}} {{- render_content(user_content, 'user message content', supported_types_desc='text, image and image_url', support_thinking=false, support_images=true) -}} {{- render_content(content=user_content, context_name='user message content', supported_types_desc='text, image and image_url', support_thinking=false, support_images=true) -}} {{- '[/INST]' }}
{#- Assistant messages supports text and thinking content. #} {%- elif message['role'] == 'assistant' %} {%- generation -%} {%- if (message['content'] is none or message['content'] == '' or message['content']|length == 0) and (message['tool_calls'] is not defined or message['tool_calls'] is none or message['tool_calls']|length == 0) %} {{- raise_exception('Assistant message must have a string or a list of chunks in content or a list of tool calls.') }} {%- endif %}
{%- if message['content'] %} {{- render_content(message['content'], 'assistant message contents', supported_types_desc='text and thinking', support_thinking=true, support_images=false) -}} {{- render_content(content=message['content'], context_name='assistant message contents', supported_types_desc='text and thinking', support_thinking=true, support_images=false) -}} {%- endif %}
{%- if message['tool_calls'] is defined and message['tool_calls'] is not none and message['tool_calls']|length > 0 %}6 unmodified lines {%- elif arguments == '' %} {%- set arguments = '{}' %} {%- endif %} {{- name + '[ARGS]' + arguments }} {{- name ~ '[ARGS]' ~ arguments }} {%- endfor %} {%- endif %}
{{- eos_token }} {%- endgeneration -%}
{#- Tool messages (multimodal). #} {%- elif message['role'] == 'tool' %} {{- '[TOOL_RESULTS]' -}} {{- render_content(message['content'], 'tool message contents', supported_types_desc='text and image', support_images=true) -}} {{- render_content(content=message['content'], context_name='tool message contents', supported_types_desc='text and image', support_thinking=false, support_images=true) -}} {{- '[/TOOL_RESULTS]' }}
{#- System messages. #} {%- elif message['role'] == 'system' %} {{- '[SYSTEM_PROMPT]' -}} {{- render_content(message['content'], 'system message contents', supported_types_desc='text', support_thinking=false, support_images=false) -}} {{- render_content(content=message['content'], context_name='system message contents', supported_types_desc='text', support_thinking=false, support_images=false) -}} {{- '[/SYSTEM_PROMPT]' -}}
{#- Raise exception for unsupported roles. #} {%- else %} {{- raise_exception('Only user, assistant, system and tool roles are supported, got ' + message['role'] + '.') }} {{- raise_exception('Only user, assistant, system and tool roles are supported, got ' ~ message['role'] ~ '.') }} {%- endif %}{%- endfor %}22 unmodified lines232425262627282926 unmodified lines5657585959606162636465666667686922 unmodified lines "attention_dropout": 0.0, "bos_token_id": 1, "eos_token_id": 2, "head_dim": 4, "head_dim": 8, "hidden_act": "silu", "hidden_size": 16, "initializer_range": 0.02,26 unmodified lines "transformers_version": "5.20.1", "vision_config": { "attention_dropout": 0.0, "head_dim": 4, "head_dim": 8, "hidden_act": "silu", "hidden_size": 16, "image_size": 1540, "initializer_range": 0.02, "intermediate_size": 32, "model_type": "pixtral", "num_attention_heads": 4, "num_attention_heads": 2, "num_channels": 3, "num_hidden_layers": 2, "patch_size": 14,12323version https://git-lfs.github.com/spec/v1oid sha256:f1372d1374a012df4dcde1eb723a92304e9e7572365a4b2c8eef9450e8a23758size 8434856oid sha256:14b2628494255f282c3f9b16d49b69969323657f3e711fbed365858cb615f4c0size 84364001008 unmodified lines1009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531008 unmodified lines "model_max_length": 1000000000000000019884624838656, "pad_token": "<pad>", "processor_class": "PixtralProcessor", "response_template": { "defaults": { "role": "assistant" }, "fields": { "content": { "close": [ "[TOOL_CALLS]", "</s>" ], "content": "text", "join": "", "repeats": true }, "reasoning_content": { "close": "[/THINK]", "content": "text", "open": "[THINK]" }, "tool_calls": { "close_pattern": "(?=\\[TOOL_CALLS\\])|</s>", "content": "json", "open_pattern": "\\[TOOL_CALLS\\](?P<name>.+?)\\[ARGS\\]", "repeats": true, "transform": { "function": { "arguments": "{content}", "name": "{name}" }, "type": "function" } } }, "start_anchor": [ "[/SYSTEM_PROMPT]", "[/INST]", "[/TOOL_RESULTS]" ] }, "tokenizer_class": "TokenizersBackend", "unk_token": "<unk>"}chat_template.jinja+71-25
config.json+3-3
model.safetensors+2-2
tokenizer_config.json+39