Instructions to use ilia-dybal/Qwen-2.5-VL-3b-Instruct-4WA16-GPTQ-Culinary with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ilia-dybal/Qwen-2.5-VL-3b-Instruct-4WA16-GPTQ-Culinary with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="ilia-dybal/Qwen-2.5-VL-3b-Instruct-4WA16-GPTQ-Culinary") 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("ilia-dybal/Qwen-2.5-VL-3b-Instruct-4WA16-GPTQ-Culinary") model = AutoModelForMultimodalLM.from_pretrained("ilia-dybal/Qwen-2.5-VL-3b-Instruct-4WA16-GPTQ-Culinary", 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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ilia-dybal/Qwen-2.5-VL-3b-Instruct-4WA16-GPTQ-Culinary with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ilia-dybal/Qwen-2.5-VL-3b-Instruct-4WA16-GPTQ-Culinary" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ilia-dybal/Qwen-2.5-VL-3b-Instruct-4WA16-GPTQ-Culinary", "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/ilia-dybal/Qwen-2.5-VL-3b-Instruct-4WA16-GPTQ-Culinary
- SGLang
How to use ilia-dybal/Qwen-2.5-VL-3b-Instruct-4WA16-GPTQ-Culinary 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 "ilia-dybal/Qwen-2.5-VL-3b-Instruct-4WA16-GPTQ-Culinary" \ --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": "ilia-dybal/Qwen-2.5-VL-3b-Instruct-4WA16-GPTQ-Culinary", "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 "ilia-dybal/Qwen-2.5-VL-3b-Instruct-4WA16-GPTQ-Culinary" \ --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": "ilia-dybal/Qwen-2.5-VL-3b-Instruct-4WA16-GPTQ-Culinary", "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 ilia-dybal/Qwen-2.5-VL-3b-Instruct-4WA16-GPTQ-Culinary with Docker Model Runner:
docker model run hf.co/ilia-dybal/Qwen-2.5-VL-3b-Instruct-4WA16-GPTQ-Culinary
Model Card for Model ID
The repository contains a finetuned version of Qwen-2.5-VL-3B-Instruct model. The model was finetuned on custom vision dataset specialized for culinary tasks: structured receipe and engredients extraction.
The model was initially finetuned in a A100 GPU with 4-bit QLoRA and post-quantized with llm-compressor using W6A16 scheme and GPTQ algorithm. The vision encoder retained untouched to preserce dynamic resolution capabilities.
Model Details
Model Description
- Developed by: Ilia Dybal
- Funded by: Ilia Dybal
- Shared by: Ilia Dybal
- Model type: Multimodal Large Visual Language Model (LVLM)
- Language(s) (NLP): Russian
- License: Apache 2.0
- Finetuned from model: Qwen/Qwen2.5-VL-3B-Instruct
Model Sources [optional]
- Repository: Qwen/Qwen2.5-VL-3B-Instruct
- Paper: https://arxiv.org/pdf/2502.13923
Uses
Direct Use
- Structured receipe and ingredients extraction from an image.
Out-of-Scope Use
- Medical or clinical dietary diagnostics.
- General non-culinary visual analysis (for general VLM tasks, use the base
Qwen2.5-VL-3B-Instruct).
Bias, Risks, and Limitations
[More Information Needed]
Recommendations
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
How to Get Started with the Model
Use the code below to get started with the model.
Option 1: Fast Serving via vLLM (Recommended for Production)
Launch the vLLM server from your terminal:
vllm serve ilia-dybal/Qwen-2.5-VL-3b-Instruct-4bit-LoRA-culinary \
--trust-remote-code \
--max-model-len 4096 \
--limit-mm-per-prompt '{"image": 1}'
Query the server using the OpenAI Python Client:
import base64
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
def encode_image(image_path):
with open(image_path, "rb") as f:
return f"data:image/jpeg;base64,{base64.b64encode(f.read()).decode('utf-8')}"
response = client.chat.completions.create(
model="ilia-dybal/Qwen-2.5-VL-3b-Instruct-4bit-LoRA-culinary",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "Analyze this dish and provide the recipe."},
{"type": "image_url", "image_url": {"url": encode_image("dish.jpg")}}
]
}
],
max_tokens=512
)
print(response.choices[0].message.content)
Option 2: Native Hugging Face Transformers
import torch
from transformers import AutoProcessor, Qwen2_5_VLForConditionalGeneration
model_id = "ilia-dybal/Qwen-2.5-VL-3b-Instruct-4bit-LoRA-culinary"
processor = AutoProcessor.from_pretrained(model_id)
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto"
)
# Prepare multimodal input
messages = [
{
"role": "user",
"content": [
{"type": "image", "image": "[https://example.com/dish.jpg](https://example.com/dish.jpg)"},
{"type": "text", "text": "List the key ingredients in this photo."}
]
}
]
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = processor(text=[text], images=None, return_tensors="pt").to("cuda")
output_ids = model.generate(**inputs, max_new_tokens=512)
print(processor.decode(output_ids[0], skip_special_tokens=True))
Training Hyperparameters
- Training regime:
- per_device_train_batch_size=16,
- per_device_eval_batch_size=16,
- gradient_accumulation_steps=4,
- num_train_epochs=15,
- gradient_checkpointing=True,
- gradient_checkpointing_kwargs={"use_reentrant": False},
- logging_strategy="steps",
- logging_steps=3,
- eval_strategy="epoch",
- bf16=True,
- logging_first_step=True,
- max_length=2048,
- learning_rate=5e-4,
Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).
- Hardware Type: 1xNVIDIA A100(40Gb)
- Hours used: 1:21:17 (15 epochs)
- Cloud Provider: Google Colab
- Downloads last month
- 79
Model tree for ilia-dybal/Qwen-2.5-VL-3b-Instruct-4WA16-GPTQ-Culinary
Base model
Qwen/Qwen2.5-VL-3B-Instruct