Image-Text-to-Text
Transformers
Safetensors
OpenVINO
English
smolvlm
video-text-to-text
openvino-export
conversational
Instructions to use echarlaix/SmolVLM2-2.2B-Instruct-openvino with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use echarlaix/SmolVLM2-2.2B-Instruct-openvino with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="echarlaix/SmolVLM2-2.2B-Instruct-openvino") 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("echarlaix/SmolVLM2-2.2B-Instruct-openvino") model = AutoModelForMultimodalLM.from_pretrained("echarlaix/SmolVLM2-2.2B-Instruct-openvino", 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 echarlaix/SmolVLM2-2.2B-Instruct-openvino with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "echarlaix/SmolVLM2-2.2B-Instruct-openvino" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "echarlaix/SmolVLM2-2.2B-Instruct-openvino", "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/echarlaix/SmolVLM2-2.2B-Instruct-openvino
- SGLang
How to use echarlaix/SmolVLM2-2.2B-Instruct-openvino 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 "echarlaix/SmolVLM2-2.2B-Instruct-openvino" \ --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": "echarlaix/SmolVLM2-2.2B-Instruct-openvino", "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 "echarlaix/SmolVLM2-2.2B-Instruct-openvino" \ --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": "echarlaix/SmolVLM2-2.2B-Instruct-openvino", "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 echarlaix/SmolVLM2-2.2B-Instruct-openvino with Docker Model Runner:
docker model run hf.co/echarlaix/SmolVLM2-2.2B-Instruct-openvino
Download openvino_text_embeddings_model.xml from echarlaix/SmolVLM2-2.2B-Instruct-openvino: direct link, hf CLI and curl.
- Browser
- Download file 2.67 kB
-
https://huggingface.co/echarlaix/SmolVLM2-2.2B-Instruct-openvino/resolve/main/openvino_text_embeddings_model.xml
- Command line
-
hf download hf://echarlaix/SmolVLM2-2.2B-Instruct-openvino/openvino_text_embeddings_model.xml
-
curl -L -o openvino_text_embeddings_model.xml https://huggingface.co/echarlaix/SmolVLM2-2.2B-Instruct-openvino/resolve/main/openvino_text_embeddings_model.xml
2.67 kB
| <net name="Model2050" version="11"> | |
| <layers> | |
| <layer id="0" name="input" type="Parameter" version="opset1"> | |
| <data shape="?,?" element_type="i64" /> | |
| <output> | |
| <port id="0" precision="I64" names="input"> | |
| <dim>-1</dim> | |
| <dim>-1</dim> | |
| </port> | |
| </output> | |
| </layer> | |
| <layer id="1" name="self.weight" type="Const" version="opset1"> | |
| <data element_type="f32" shape="49280, 2048" offset="0" size="403701760" /> | |
| <output> | |
| <port id="0" precision="FP32" names="self.weight"> | |
| <dim>49280</dim> | |
| <dim>2048</dim> | |
| </port> | |
| </output> | |
| </layer> | |
| <layer id="2" name="aten::embedding/Convert" type="Convert" version="opset1"> | |
| <data destination_type="i32" /> | |
| <input> | |
| <port id="0" precision="I64"> | |
| <dim>-1</dim> | |
| <dim>-1</dim> | |
| </port> | |
| </input> | |
| <output> | |
| <port id="1" precision="I32"> | |
| <dim>-1</dim> | |
| <dim>-1</dim> | |
| </port> | |
| </output> | |
| </layer> | |
| <layer id="3" name="aten::embedding/Constant" type="Const" version="opset1"> | |
| <data element_type="i32" shape="" offset="403701760" size="4" /> | |
| <output> | |
| <port id="0" precision="I32" /> | |
| </output> | |
| </layer> | |
| <layer id="4" name="aten::embedding/Gather" type="Gather" version="opset8"> | |
| <data batch_dims="0" /> | |
| <input> | |
| <port id="0" precision="FP32"> | |
| <dim>49280</dim> | |
| <dim>2048</dim> | |
| </port> | |
| <port id="1" precision="I32"> | |
| <dim>-1</dim> | |
| <dim>-1</dim> | |
| </port> | |
| <port id="2" precision="I32" /> | |
| </input> | |
| <output> | |
| <port id="3" precision="FP32" names="inputs_embeds"> | |
| <dim>-1</dim> | |
| <dim>-1</dim> | |
| <dim>2048</dim> | |
| </port> | |
| </output> | |
| </layer> | |
| <layer id="5" name="Result_2154973" type="Result" version="opset1" output_names="inputs_embeds"> | |
| <input> | |
| <port id="0" precision="FP32"> | |
| <dim>-1</dim> | |
| <dim>-1</dim> | |
| <dim>2048</dim> | |
| </port> | |
| </input> | |
| </layer> | |
| </layers> | |
| <edges> | |
| <edge from-layer="0" from-port="0" to-layer="2" to-port="0" /> | |
| <edge from-layer="1" from-port="0" to-layer="4" to-port="0" /> | |
| <edge from-layer="2" from-port="1" to-layer="4" to-port="1" /> | |
| <edge from-layer="3" from-port="0" to-layer="4" to-port="2" /> | |
| <edge from-layer="4" from-port="3" to-layer="5" to-port="0" /> | |
| </edges> | |
| <rt_info> | |
| <Runtime_version value="2025.1.0-18503-6fec06580ab-releases/2025/1" /> | |
| <conversion_parameters> | |
| <framework value="pytorch" /> | |
| <is_python_object value="True" /> | |
| </conversion_parameters> | |
| <optimum> | |
| <optimum_intel_version value="1.23.0" /> | |
| <optimum_version value="1.25.1" /> | |
| <pytorch_version value="2.7.0" /> | |
| <transformers_version value="4.51.3" /> | |
| </optimum> | |
| </rt_info> | |
| </net> | |