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
FP8 weights, like the reference checkpoint
#1
by qgallouedec HF Staff - opened
- config.json +15 -0
- model.safetensors +2 -2
config.json
CHANGED
|
@@ -7,10 +7,24 @@
|
|
| 7 |
"model_type": "mistral3",
|
| 8 |
"multimodal_projector_bias": false,
|
| 9 |
"projector_hidden_act": "gelu",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
"spatial_merge_size": 2,
|
| 11 |
"text_config": {
|
| 12 |
"attention_dropout": 0.0,
|
| 13 |
"bos_token_id": 1,
|
|
|
|
| 14 |
"eos_token_id": 2,
|
| 15 |
"head_dim": 4,
|
| 16 |
"hidden_act": "silu",
|
|
@@ -45,6 +59,7 @@
|
|
| 45 |
"transformers_version": "5.20.1",
|
| 46 |
"vision_config": {
|
| 47 |
"attention_dropout": 0.0,
|
|
|
|
| 48 |
"head_dim": 4,
|
| 49 |
"hidden_act": "silu",
|
| 50 |
"hidden_size": 16,
|
|
|
|
| 7 |
"model_type": "mistral3",
|
| 8 |
"multimodal_projector_bias": false,
|
| 9 |
"projector_hidden_act": "gelu",
|
| 10 |
+
"quantization_config": {
|
| 11 |
+
"activation_scheme": "static",
|
| 12 |
+
"dequantize": false,
|
| 13 |
+
"modules_to_convert": null,
|
| 14 |
+
"modules_to_not_convert": [
|
| 15 |
+
"model.vision_tower",
|
| 16 |
+
"model.multi_modal_projector",
|
| 17 |
+
"lm_head"
|
| 18 |
+
],
|
| 19 |
+
"quant_method": "fp8",
|
| 20 |
+
"scale_fmt": "float",
|
| 21 |
+
"weight_block_size": null
|
| 22 |
+
},
|
| 23 |
"spatial_merge_size": 2,
|
| 24 |
"text_config": {
|
| 25 |
"attention_dropout": 0.0,
|
| 26 |
"bos_token_id": 1,
|
| 27 |
+
"dtype": "bfloat16",
|
| 28 |
"eos_token_id": 2,
|
| 29 |
"head_dim": 4,
|
| 30 |
"hidden_act": "silu",
|
|
|
|
| 59 |
"transformers_version": "5.20.1",
|
| 60 |
"vision_config": {
|
| 61 |
"attention_dropout": 0.0,
|
| 62 |
+
"dtype": "bfloat16",
|
| 63 |
"head_dim": 4,
|
| 64 |
"hidden_act": "silu",
|
| 65 |
"hidden_size": 16,
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:dbed97fcc1aefed3c5f0c029faa4470b105a88f674c996265456e41de7c63a46
|
| 3 |
+
size 8434520
|