Instructions to use HuggingFaceTB/SmolVLM2-256M-Video-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use HuggingFaceTB/SmolVLM2-256M-Video-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="HuggingFaceTB/SmolVLM2-256M-Video-Instruct") 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, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("HuggingFaceTB/SmolVLM2-256M-Video-Instruct") model = AutoModelForImageTextToText.from_pretrained("HuggingFaceTB/SmolVLM2-256M-Video-Instruct") 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
- vLLM
How to use HuggingFaceTB/SmolVLM2-256M-Video-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "HuggingFaceTB/SmolVLM2-256M-Video-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HuggingFaceTB/SmolVLM2-256M-Video-Instruct", "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/HuggingFaceTB/SmolVLM2-256M-Video-Instruct
- SGLang
How to use HuggingFaceTB/SmolVLM2-256M-Video-Instruct 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 "HuggingFaceTB/SmolVLM2-256M-Video-Instruct" \ --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": "HuggingFaceTB/SmolVLM2-256M-Video-Instruct", "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 "HuggingFaceTB/SmolVLM2-256M-Video-Instruct" \ --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": "HuggingFaceTB/SmolVLM2-256M-Video-Instruct", "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 HuggingFaceTB/SmolVLM2-256M-Video-Instruct with Docker Model Runner:
docker model run hf.co/HuggingFaceTB/SmolVLM2-256M-Video-Instruct
Correct pipeline tag, add link to paper
#10
by nielsr HF Staff - opened
README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
|
| 4 |
datasets:
|
| 5 |
- HuggingFaceM4/the_cauldron
|
| 6 |
- HuggingFaceM4/Docmatix
|
|
@@ -14,17 +14,19 @@ datasets:
|
|
| 14 |
- TIGER-Lab/VISTA-400K
|
| 15 |
- Enxin/MovieChat-1K_train
|
| 16 |
- ShareGPT4Video/ShareGPT4Video
|
| 17 |
-
pipeline_tag: image-text-to-text
|
| 18 |
language:
|
| 19 |
- en
|
| 20 |
-
|
| 21 |
-
|
|
|
|
| 22 |
---
|
| 23 |
|
| 24 |
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/SmolVLM2_banner.png" width="800" height="auto" alt="Image description">
|
| 25 |
|
| 26 |
# SmolVLM2-256M-Video
|
| 27 |
|
|
|
|
|
|
|
| 28 |
SmolVLM2-256M-Video is a lightweight multimodal model designed to analyze video content. The model processes videos, images, and text inputs to generate text outputs - whether answering questions about media files, comparing visual content, or transcribing text from images. Despite its compact size, requiring only 1.38GB of GPU RAM for video inference. This efficiency makes it particularly well-suited for on-device applications that require specific domain fine-tuning and computational resources may be limited.
|
| 29 |
## Model Summary
|
| 30 |
|
|
@@ -207,12 +209,7 @@ You can cite us in the following way:
|
|
| 207 |
## Training Data
|
| 208 |
SmolVLM2 used 3.3M samples for training originally from ten different datasets: [LlaVa Onevision](https://huggingface.co/datasets/lmms-lab/LLaVA-OneVision-Data), [M4-Instruct](https://huggingface.co/datasets/lmms-lab/M4-Instruct-Data), [Mammoth](https://huggingface.co/datasets/MAmmoTH-VL/MAmmoTH-VL-Instruct-12M), [LlaVa Video 178K](https://huggingface.co/datasets/lmms-lab/LLaVA-Video-178K), [FineVideo](https://huggingface.co/datasets/HuggingFaceFV/finevideo), [VideoStar](https://huggingface.co/datasets/orrzohar/Video-STaR), [VRipt](https://huggingface.co/datasets/Mutonix/Vript), [Vista-400K](https://huggingface.co/datasets/TIGER-Lab/VISTA-400K), [MovieChat](https://huggingface.co/datasets/Enxin/MovieChat-1K_train) and [ShareGPT4Video](https://huggingface.co/datasets/ShareGPT4Video/ShareGPT4Video).
|
| 209 |
In the following plots we give a general overview of the samples across modalities and the source of those samples.
|
| 210 |
-
<!--
|
| 211 |
-
<center><img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/smolvlm2_data_split.png" width="auto" height="auto" alt="Image description">
|
| 212 |
-
</center>
|
| 213 |
|
| 214 |
-
### Details
|
| 215 |
-
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/smolvlm2_datadetails.png" width="auto" height="auto" alt="Image description"> -->
|
| 216 |
|
| 217 |
## Data Split per modality
|
| 218 |
|
|
@@ -266,4 +263,4 @@ In the following plots we give a general overview of the samples across modaliti
|
|
| 266 |
| video-star/starb | 2.2% |
|
| 267 |
| vista-400k/combined | 2.2% |
|
| 268 |
| vript/long | 1.0% |
|
| 269 |
-
| ShareGPT4Video/all | 0.8% |
|
|
|
|
| 1 |
---
|
| 2 |
+
base_model:
|
| 3 |
+
- HuggingFaceTB/SmolVLM-256M-Instruct
|
| 4 |
datasets:
|
| 5 |
- HuggingFaceM4/the_cauldron
|
| 6 |
- HuggingFaceM4/Docmatix
|
|
|
|
| 14 |
- TIGER-Lab/VISTA-400K
|
| 15 |
- Enxin/MovieChat-1K_train
|
| 16 |
- ShareGPT4Video/ShareGPT4Video
|
|
|
|
| 17 |
language:
|
| 18 |
- en
|
| 19 |
+
library_name: transformers
|
| 20 |
+
license: apache-2.0
|
| 21 |
+
pipeline_tag: video-text-to-text
|
| 22 |
---
|
| 23 |
|
| 24 |
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/SmolVLM2_banner.png" width="800" height="auto" alt="Image description">
|
| 25 |
|
| 26 |
# SmolVLM2-256M-Video
|
| 27 |
|
| 28 |
+
This repository contains the model as presented in [SmolVLM: Redefining small and efficient multimodal models](https://huggingface.co/papers/2504.05299).
|
| 29 |
+
|
| 30 |
SmolVLM2-256M-Video is a lightweight multimodal model designed to analyze video content. The model processes videos, images, and text inputs to generate text outputs - whether answering questions about media files, comparing visual content, or transcribing text from images. Despite its compact size, requiring only 1.38GB of GPU RAM for video inference. This efficiency makes it particularly well-suited for on-device applications that require specific domain fine-tuning and computational resources may be limited.
|
| 31 |
## Model Summary
|
| 32 |
|
|
|
|
| 209 |
## Training Data
|
| 210 |
SmolVLM2 used 3.3M samples for training originally from ten different datasets: [LlaVa Onevision](https://huggingface.co/datasets/lmms-lab/LLaVA-OneVision-Data), [M4-Instruct](https://huggingface.co/datasets/lmms-lab/M4-Instruct-Data), [Mammoth](https://huggingface.co/datasets/MAmmoTH-VL/MAmmoTH-VL-Instruct-12M), [LlaVa Video 178K](https://huggingface.co/datasets/lmms-lab/LLaVA-Video-178K), [FineVideo](https://huggingface.co/datasets/HuggingFaceFV/finevideo), [VideoStar](https://huggingface.co/datasets/orrzohar/Video-STaR), [VRipt](https://huggingface.co/datasets/Mutonix/Vript), [Vista-400K](https://huggingface.co/datasets/TIGER-Lab/VISTA-400K), [MovieChat](https://huggingface.co/datasets/Enxin/MovieChat-1K_train) and [ShareGPT4Video](https://huggingface.co/datasets/ShareGPT4Video/ShareGPT4Video).
|
| 211 |
In the following plots we give a general overview of the samples across modalities and the source of those samples.
|
|
|
|
|
|
|
|
|
|
| 212 |
|
|
|
|
|
|
|
| 213 |
|
| 214 |
## Data Split per modality
|
| 215 |
|
|
|
|
| 263 |
| video-star/starb | 2.2% |
|
| 264 |
| vista-400k/combined | 2.2% |
|
| 265 |
| vript/long | 1.0% |
|
| 266 |
+
| ShareGPT4Video/all | 0.8% |
|