Instructions to use trl-internal-testing/tiny-Idefics3ForConditionalGeneration with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use trl-internal-testing/tiny-Idefics3ForConditionalGeneration 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-Idefics3ForConditionalGeneration") 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)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("trl-internal-testing/tiny-Idefics3ForConditionalGeneration") model = AutoModelForMultimodalLM.from_pretrained("trl-internal-testing/tiny-Idefics3ForConditionalGeneration") 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=40) 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-Idefics3ForConditionalGeneration 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-Idefics3ForConditionalGeneration" # 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-Idefics3ForConditionalGeneration", "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-Idefics3ForConditionalGeneration
- SGLang
How to use trl-internal-testing/tiny-Idefics3ForConditionalGeneration 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-Idefics3ForConditionalGeneration" \ --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-Idefics3ForConditionalGeneration", "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-Idefics3ForConditionalGeneration" \ --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-Idefics3ForConditionalGeneration", "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-Idefics3ForConditionalGeneration with Docker Model Runner:
docker model run hf.co/trl-internal-testing/tiny-Idefics3ForConditionalGeneration
Upload Idefics3ForConditionalGeneration
Browse files- config.json +5 -3
- generation_config.json +1 -1
- model.safetensors +1 -1
config.json
CHANGED
|
@@ -2,6 +2,7 @@
|
|
| 2 |
"architectures": [
|
| 3 |
"Idefics3ForConditionalGeneration"
|
| 4 |
],
|
|
|
|
| 5 |
"image_token_id": 128257,
|
| 6 |
"model_type": "idefics3",
|
| 7 |
"pad_token_id": 128002,
|
|
@@ -19,6 +20,7 @@
|
|
| 19 |
"AutoModelForCausalLM": "modeling_idefics3.Idefics3ForVisionText2Text"
|
| 20 |
},
|
| 21 |
"bos_token_id": 128000,
|
|
|
|
| 22 |
"eos_token_id": [
|
| 23 |
128001,
|
| 24 |
128008,
|
|
@@ -29,6 +31,7 @@
|
|
| 29 |
"hidden_size": 16,
|
| 30 |
"initializer_range": 0.02,
|
| 31 |
"intermediate_size": 14336,
|
|
|
|
| 32 |
"max_position_embeddings": 131072,
|
| 33 |
"mlp_bias": false,
|
| 34 |
"model_type": "llama",
|
|
@@ -120,17 +123,16 @@
|
|
| 120 |
"rope_type": "llama3"
|
| 121 |
},
|
| 122 |
"rope_theta": 500000.0,
|
| 123 |
-
"torch_dtype": "bfloat16",
|
| 124 |
"use_cache": true,
|
| 125 |
"use_resampler": false,
|
| 126 |
"vocab_size": 128259
|
| 127 |
},
|
| 128 |
"tie_word_embeddings": false,
|
| 129 |
-
"
|
| 130 |
-
"transformers_version": "4.56.0.dev0",
|
| 131 |
"use_cache": true,
|
| 132 |
"vision_config": {
|
| 133 |
"attention_dropout": 0.0,
|
|
|
|
| 134 |
"hidden_act": "gelu_pytorch_tanh",
|
| 135 |
"hidden_size": 16,
|
| 136 |
"image_size": 364,
|
|
|
|
| 2 |
"architectures": [
|
| 3 |
"Idefics3ForConditionalGeneration"
|
| 4 |
],
|
| 5 |
+
"dtype": "bfloat16",
|
| 6 |
"image_token_id": 128257,
|
| 7 |
"model_type": "idefics3",
|
| 8 |
"pad_token_id": 128002,
|
|
|
|
| 20 |
"AutoModelForCausalLM": "modeling_idefics3.Idefics3ForVisionText2Text"
|
| 21 |
},
|
| 22 |
"bos_token_id": 128000,
|
| 23 |
+
"dtype": "bfloat16",
|
| 24 |
"eos_token_id": [
|
| 25 |
128001,
|
| 26 |
128008,
|
|
|
|
| 31 |
"hidden_size": 16,
|
| 32 |
"initializer_range": 0.02,
|
| 33 |
"intermediate_size": 14336,
|
| 34 |
+
"layer_types": null,
|
| 35 |
"max_position_embeddings": 131072,
|
| 36 |
"mlp_bias": false,
|
| 37 |
"model_type": "llama",
|
|
|
|
| 123 |
"rope_type": "llama3"
|
| 124 |
},
|
| 125 |
"rope_theta": 500000.0,
|
|
|
|
| 126 |
"use_cache": true,
|
| 127 |
"use_resampler": false,
|
| 128 |
"vocab_size": 128259
|
| 129 |
},
|
| 130 |
"tie_word_embeddings": false,
|
| 131 |
+
"transformers_version": "4.57.0.dev0",
|
|
|
|
| 132 |
"use_cache": true,
|
| 133 |
"vision_config": {
|
| 134 |
"attention_dropout": 0.0,
|
| 135 |
+
"embed_dim": 32,
|
| 136 |
"hidden_act": "gelu_pytorch_tanh",
|
| 137 |
"hidden_size": 16,
|
| 138 |
"image_size": 364,
|
generation_config.json
CHANGED
|
@@ -7,5 +7,5 @@
|
|
| 7 |
128009
|
| 8 |
],
|
| 9 |
"pad_token_id": 128002,
|
| 10 |
-
"transformers_version": "4.
|
| 11 |
}
|
|
|
|
| 7 |
128009
|
| 8 |
],
|
| 9 |
"pad_token_id": 128002,
|
| 10 |
+
"transformers_version": "4.57.0.dev0"
|
| 11 |
}
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 11682096
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b27ea2b8b1c0a8ec9a57b425e85c05f8832cfcf202d0945a879ffd675143c3db
|
| 3 |
size 11682096
|