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
#2
by albertvillanova HF Staff - opened
Files changed (2)
9 unmodified lines10111213141516171819202122232425262728293028 unmodified lines596061626364659 unmodified lines"quantization_config": {"activation_scheme": "static","dequantize": false,"modules_to_convert": null,"modules_to_not_convert": ["model.vision_tower","model.multi_modal_projector","lm_head"],"quant_method": "fp8","scale_fmt": "float","weight_block_size": null},"spatial_merge_size": 2,"text_config": {"attention_dropout": 0.0,"bos_token_id": 1,"dtype": "bfloat16","eos_token_id": 2,"head_dim": 4,"hidden_act": "silu",28 unmodified lines"transformers_version": "5.20.1","vision_config": {"attention_dropout": 0.0,"dtype": "bfloat16","head_dim": 4,"hidden_act": "silu","hidden_size": 16,9 unmodified lines10111213141516171819202122232425262728 unmodified lines5657585960619 unmodified lines"quantization_config": {"activation_scheme": "static","dequantize": false,"modules_to_not_convert": ["model.vision_tower","model.multi_modal_projector","lm_head"],"quant_method": "fp8","weight_block_size": null},"spatial_merge_size": 2,"text_config": {"attention_dropout": 0.0,"bos_token_id": 1,"eos_token_id": 2,"head_dim": 4,"hidden_act": "silu",28 unmodified lines"transformers_version": "5.20.1","vision_config": {"attention_dropout": 0.0,"head_dim": 4,"hidden_act": "silu","hidden_size": 16,
123version https://git-lfs.github.com/spec/v1oid sha256:dbed97fcc1aefed3c5f0c029faa4470b105a88f674c996265456e41de7c63a46size 8434520123version https://git-lfs.github.com/spec/v1oid sha256:f1372d1374a012df4dcde1eb723a92304e9e7572365a4b2c8eef9450e8a23758size 8434856
config.json-4
model.safetensors+2-2