Downloads · 30 days
92
7% of all-time downloads
wangkanai/qwen2.5-vl-32b-instruct
qwen2.5-vl-32b-instruct is a image-text-to-text model from wangkanai. 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.
A 32-billion parameter vision-language model with enhanced mathematical reasoning, multimodal understanding, and removed safety guardrails.
Downloads · 30 days
92
7% of all-time downloads
All-time downloads
1.4K
Public
Repo size
176 GB
Likes
2
Public
Click a slice to open those files.
.gguf109 GB · 62%
From the Hugging Face model README
A 32-billion parameter vision-language model with enhanced mathematical reasoning, multimodal understanding, and removed safety guardrails.
Qwen2.5-VL-32B-Instruct-Abliterated is an uncensored variant of the instruction-tuned Qwen2.5-VL-32B model, developed by Qwen team at Alibaba Cloud with abliteration processing to remove refusal mechanisms. This model maintains the original's advanced vision-language capabilities while providing unrestricted responses without safety filtering or content moderation.
Vision-Language Understanding:
Enhanced Reasoning:
Abliteration Features:
Model Files:
qwen2.5-vl-32b-instruct-abliterated.safetensors - Full precision model weights (63GB, BF16 precision)qwen2.5-vl-32b-instruct-abliterated-f16.gguf - GGUF FP16 format (62GB)qwen2.5-vl-32b-instruct-abliterated-q5-k-m.gguf - GGUF Q5_K_M quantized (22GB)qwen2.5-vl-32b-instruct-abliterated-q4-k-m.gguf - GGUF Q4_K_M quantized (19GB)Additional Files (download from Hugging Face):
config.json - Model configurationpreprocessor_config.json - Image/video preprocessing settingstokenizer.json / tokenizer_config.json - Tokenizer filesgeneration_config.json - Text generation parametersprocessor_config.json - Unified processor configurationTotal Repository Size: 166GB (all formats combined)
Safetensors (BF16 - 63GB):
GGUF F16 (62GB):
GGUF Q5_K_M (22GB):
GGUF Q4_K_M (19GB):
High-Quality Inference (Safetensors/F16):
Balanced Performance (Q5_K_M):
Consumer Hardware (Q4_K_M):
Production Deployment:
For Safetensors (Transformers):
# Install from transformers source (recommended)
pip install git+https://github.com/huggingface/transformers accelerate
pip install qwen-vl-utils[decord]==0.0.8
# Additional dependencies
pip install torch torchvision pillow
For GGUF Files (llama.cpp):
# Install llama-cpp-python with GPU support
pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu121
# Or build llama.cpp from source
git clone https://github.com/ggerganov/llama.cpp
cd llama.cpp
make LLAMA_CUDA=1 # For NVIDIA GPUs
# or
make LLAMA_METAL=1 # For Apple Silicon
from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
from PIL import Image
import torch
# Load model and processor
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
"E:/huggingface/qwen2.5-vl-32b-instruct",
torch_dtype=torch.bfloat16,
device_map="auto"
)
processor = AutoProcessor.from_pretrained("E:/huggingface/qwen2.5-vl-32b-instruct")
# Prepare image and text input
image = Image.open("your_image.jpg")
messages = [
{
"role": "user",
"content": [
{"type": "image", "image": image},
{"type": "text", "text": "Describe this image in detail."}
]
}
]
# Process and generate
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = processor(text=[text], images=[image], return_tensors="pt", padding=True)
inputs = inputs.to("cuda")
# Generate response
output_ids = model.generate(**inputs, max_new_tokens=512)
generated_text = processor.batch_decode(output_ids, skip_special_tokens=True)
print(generated_text[0])
# Multiple images in conversation
messages = [
{
"role": "user",
"content": [
{"type": "image", "image": "image1.jpg"},
{"type": "image", "image": "image2.jpg"},
{"type": "text", "text": "Compare these two images and identify the differences."}
]
}
]
# Process with multiple images
images = [Image.open("image1.jpg"), Image.open("image2.jpg")]
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = processor(text=[text], images=images, return_tensors="pt")
inputs = inputs.to("cuda")
output_ids = model.generate(**inputs, max_new_tokens=1024)
response = processor.batch_decode(output_ids, skip_special_tokens=True)
print(response[0])
from qwen_vl_utils import process_vision_info
# Process video input
messages = [
{
"role": "user",
"content": [
{"type": "video", "video": "your_video.mp4", "fps": 1.0},
{"type": "text", "text": "Summarize the main events in this video."}
]
}
]
# Process video with configurable FPS
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
image_inputs, video_inputs = process_vision_info(messages)
inputs = processor(
text=[text],
images=image_inputs,
videos=video_inputs,
padding=True,
return_tensors="pt"
)
inputs = inputs.to("cuda")
# Generate video analysis
output_ids = model.generate(**inputs, max_new_tokens=1024)
response = processor.batch_decode(output_ids, skip_special_tokens=True)
print(response[0])
# Enhanced mathematical reasoning
messages = [
{
"role": "user",
"content": [
{"type": "image", "image": "math_diagram.png"},
{"type": "text", "text": "Solve this geometry problem step by step."}
]
}
]
# Process with detailed reasoning
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = processor(text=[text], images=[Image.open("math_diagram.png")], return_tensors="pt")
inputs = inputs.to("cuda")
# Generate detailed solution
output_ids = model.generate(**inputs, max_new_tokens=2048, do_sample=False)
solution = processor.batch_decode(output_ids, skip_special_tokens=True)
print(solution[0])
# Extract structured information from documents
messages = [
{
"role": "user",
"content": [
{"type": "image", "image": "invoice.jpg"},
{"type": "text", "text": "Extract all line items from this invoice in JSON format."}
]
}
]
# Process document
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = processor(text=[text], images=[Image.open("invoice.jpg")], return_tensors="pt")
inputs = inputs.to("cuda")
# Generate structured output
output_ids = model.generate(**inputs, max_new_tokens=1024, temperature=0.1)
structured_data = processor.batch_decode(output_ids, skip_special_tokens=True)
print(structured_data[0])
# Adjust visual token resolution
processor_config = processor.image_processor
processor_config.min_pixels = 256 * 256 # Minimum resolution
processor_config.max_pixels = 2048 * 2048 # Maximum resolution
# Process with custom resolution
inputs = processor(
text=[text],
images=[image],
return_tensors="pt",
resized_height=1024,
resized_width=1024
)
# Efficient batch inference
batch_messages = [
[{"role": "user", "content": [{"type": "image", "image": f"img{i}.jpg"},
{"type": "text", "text": "Describe this image."}]}]
for i in range(4)
]
# Process batch
texts = [processor.apply_chat_template(msg, tokenize=False, add_generation_prompt=True)
for msg in batch_messages]
images_batch = [Image.open(f"img{i}.jpg") for i in range(4)]
inputs = processor(text=texts, images=images_batch, return_tensors="pt", padding=True)
inputs = inputs.to("cuda")
# Batch generation
output_ids = model.generate(**inputs, max_new_tokens=512)
responses = processor.batch_decode(output_ids, skip_special_tokens=True)
for i, resp in enumerate(responses):
print(f"Image {i}: {resp}")
Using llama-cpp-python:
from llama_cpp import Llama
from llama_cpp.llama_chat_format import Qwen2VLChatHandler
# Initialize model with vision support
chat_handler = Qwen2VLChatHandler()
llm = Llama(
model_path="E:/huggingface/qwen2.5-vl-32b-instruct/qwen2.5-vl-32b-instruct-abliterated-q4-k-m.gguf",
chat_handler=chat_handler,
n_ctx=32768, # Context window
n_gpu_layers=50, # Offload layers to GPU (-1 for all)
n_batch=512,
verbose=False
)
# Vision-language inference
response = llm.create_chat_completion(
messages=[
{
"role": "user",
"content": [
{"type": "image_url", "image_url": {"url": "file:///path/to/image.jpg"}},
{"type": "text", "text": "Describe this image in detail."}
]
}
],
max_tokens=512,
temperature=0.7
)
print(response['choices'][0]['message']['content'])
Using llama.cpp CLI:
# GPU-accelerated inference with Q4_K_M
./llama-cli \
-m E:/huggingface/qwen2.5-vl-32b-instruct/qwen2.5-vl-32b-instruct-abliterated-q4-k-m.gguf \
--image your_image.jpg \
-p "Describe this image in detail." \
-n 512 \
-ngl 50 \
--ctx-size 32768
# CPU-only inference with Q5_K_M
./llama-cli \
-m E:/huggingface/qwen2.5-vl-32b-instruct/qwen2.5-vl-32b-instruct-abliterated-q5-k-m.gguf \
--image your_image.jpg \
-p "What objects are in this image?" \
-n 256 \
-t 16 \
--ctx-size 8192
# Server mode for API access
./llama-server \
-m E:/huggingface/qwen2.5-vl-32b-instruct/qwen2.5-vl-32b-instruct-abliterated-q4-k-m.gguf \
--host 0.0.0.0 \
--port 8080 \
-ngl 50 \
--ctx-size 32768
GPU Layer Offloading Guide (GGUF):
| Model File | Full GPU (ngl) | 24GB GPU (ngl) | 16GB GPU (ngl) | CPU Only (ngl) |
|---|---|---|---|---|
| F16 (62GB) | -1 (all) | ~20 layers | ~10 layers | 0 |
| Q5_K_M (22GB) | -1 (all) | ~40 layers | ~25 layers | 0 |
| Q4_K_M (19GB) | -1 (all) | 50+ layers | ~35 layers | 0 |
Performance Comparison:
Safetensors (63GB):
GGUF Formats:
| Benchmark | Score | Category |
|---|---|---|
| MMMU | 70.0 | Multimodal Understanding |
| MMMU-Pro | - | Advanced Reasoning |
| MathVista | 74.7 | Mathematical Reasoning |
| DocVQA | 94.8 | Document Understanding |
| Android Control | 69.6/93.3 | Agentic Interaction |
| MMLU | 78.4 | Language Understanding |
| MATH | 82.2 | Mathematical Problem Solving |
| HumanEval | 91.5 | Code Generation |
Flash Attention 2 (Recommended):
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
"E:/huggingface/qwen2.5-vl-32b-instruct",
torch_dtype=torch.bfloat16,
attn_implementation="flash_attention_2", # 2-3x faster
device_map="auto"
)
Quantization for Memory Efficiency:
# INT8 quantization (requires bitsandbytes)
from transformers import BitsAndBytesConfig
quantization_config = BitsAndBytesConfig(
load_in_8bit=True,
llm_int8_threshold=6.0
)
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
"E:/huggingface/qwen2.5-vl-32b-instruct",
quantization_config=quantization_config,
device_map="auto"
)
Extended Context (YaRN):
# For sequences > 32K tokens
model.config.rope_scaling = {
"type": "yarn",
"factor": 4.0, # Extend to 128K tokens
"original_max_position_embeddings": 32768
}
# Clear CUDA cache between runs
import torch
torch.cuda.empty_cache()
# Gradient checkpointing for fine-tuning
model.gradient_checkpointing_enable()
# CPU offloading for large batches
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
"E:/huggingface/qwen2.5-vl-32b-instruct",
torch_dtype=torch.bfloat16,
device_map="auto",
offload_folder="offload",
offload_state_dict=True
)
Using vLLM (High Throughput):
pip install vllm
python -m vllm.entrypoints.openai.api_server \
--model E:/huggingface/qwen2.5-vl-32b-instruct \
--dtype bfloat16 \
--max-model-len 32768 \
--gpu-memory-utilization 0.9
Using Text Generation Inference:
docker run --gpus all --shm-size 1g -p 8080:80 \
-v E:/huggingface/qwen2.5-vl-32b-instruct:/data \
ghcr.io/huggingface/text-generation-inference:latest \
--model-id /data --dtype bfloat16
The model supports fine-tuning using standard Hugging Face training workflows:
from transformers import Trainer, TrainingArguments
training_args = TrainingArguments(
output_dir="./qwen-vl-finetuned",
per_device_train_batch_size=1,
gradient_accumulation_steps=16,
learning_rate=2e-5,
num_train_epochs=3,
bf16=True,
logging_steps=10,
save_strategy="epoch"
)
trainer = Trainer(
model=model,
args=training_args,
train_dataset=train_dataset,
data_collator=data_collator
)
trainer.train()
This model is released under the Apache License 2.0 (base model license).
Copyright 2025 Alibaba Cloud (base model)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
⚠️ This is an uncensored, abliterated variant with removed safety mechanisms:
If you use Qwen2.5-VL-32B-Instruct in your research or applications, please cite:
@article{qwen2.5-vl,
title={Qwen2.5-VL Technical Report},
author={Bai, Jinze and others},
journal={arXiv preprint arXiv:2502.13923},
year={2025},
url={https://arxiv.org/abs/2502.13923}
}
Base Model: Qwen Team, Alibaba Cloud Abliteration: Community modification (uncensored variant) Base Release Date: March 25, 2025 Model Version: 2.5 (abliterated) README Version: v1.1