Downloads · 30 days
28
15% of all-time downloads
ronantakizawa/SmolVLM-Instruct-gptq
SmolVLM-Instruct-gptq is a image-text-to-text model from ronantakizawa. Use it for the image-text-to-text task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
This is a 4-bit GPTQ quantized version of HuggingFaceTB/SmolVLM-Instruct, a 2.2B parameter vision-language model.
Downloads · 30 days
28
15% of all-time downloads
All-time downloads
184
Public
Parameters
2.3B
2.1 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors2.1 GB · 100%
How the weights are stored.
I321.6B · 71%
From the Hugging Face model README
This is a 4-bit GPTQ quantized version of HuggingFaceTB/SmolVLM-Instruct, a 2.2B parameter vision-language model.
✅ Quantized to 4-bit:
❌ Preserved at full precision:
pip install transformers torch pillow
from transformers import Idefics3ForConditionalGeneration, AutoProcessor
from PIL import Image
import requests
# Load model and processor
model = Idefics3ForConditionalGeneration.from_pretrained(
"ronantakizawa/SmolVLM-Instruct-GPTQ-4bit",
device_map="auto",
torch_dtype="auto"
)
processor = AutoProcessor.from_pretrained("ronantakizawa/SmolVLM-Instruct-GPTQ-4bit")
# Load an image
url = "https://huggingface.co/spaces/merve/chatml-llava/resolve/main/bee.jpg"
image = Image.open(requests.get(url, stream=True).raw)
# Create prompt
messages = [
{
"role": "user",
"content": [
{"type": "image"},
{"type": "text", "text": "Describe this image in detail."}
]
}
]
# Generate
prompt = processor.apply_chat_template(messages, add_generation_prompt=True)
inputs = processor(text=prompt, images=[image], return_tensors="pt").to(model.device)
generated_ids = model.generate(**inputs, max_new_tokens=500)
generated_texts = processor.batch_decode(
generated_ids,
skip_special_tokens=True,
)
print(generated_texts[0])
pip install vllm
python -m vllm.entrypoints.openai.api_server \
--model ronantakizawa/SmolVLM-Instruct-GPTQ-4bit \
--quantization gptq \
--dtype auto
Then use the OpenAI-compatible API:
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:8000/v1",
api_key="dummy"
)
response = client.chat.completions.create(
model="ronantakizawa/SmolVLM-Instruct-GPTQ-4bit",
messages=[
{
"role": "user",
"content": [
{"type": "image_url", "image_url": {"url": "https://example.com/image.jpg"}},
{"type": "text", "text": "What's in this image?"}
]
}
]
)
print(response.choices[0].message.content)
GPTQModifier(
targets="Linear",
scheme="W4A16",
ignore=[
"re:.*lm_head",
"re:.*vision_model.*",
"re:.*connector.*",
"re:.*vision_tower.*"
]
)
LlamaDecoderLayer| Metric | Value |
|---|---|
| Original Size | 4.4 GB |
| Quantized Size | 1.97 GB |
| Compression Ratio | 2.23x (55% reduction) |
| GPU Memory (inference) | ~2-3 GB |
| Vision Quality | Preserved (no degradation) |
| Text Quality | Under 1% quality degradation in DocVQA |
This model was quantized using custom patches to llm-compressor to support the idefics3 architecture:
If you use this model, please cite the original SmolVLM work:
@misc{smolvlm2024,
title={SmolVLM: Small Vision-Language Model},
author={HuggingFace Team},
year={2024},
publisher={HuggingFace},
url={https://huggingface.co/HuggingFaceTB/SmolVLM-Instruct}
}
And the quantization tool:
@software{llmcompressor2024,
title={LLM Compressor},
author={Neural Magic},
year={2024},
url={https://github.com/vllm-project/llm-compressor}
}
This model inherits the Apache 2.0 license from the base model.