Views
No views yet
qwen3-vl-2b-thinking/
├── qwen3-vl-2b-thinking-abliterated.safetensors # PyTorch model (4.0GB)
└── qwen3-vl-2b-thinking-abliterated-f16.gguf # GGUF FP16 quantized (3.3GB)| File | Format | Size | Use Case |
|---|---|---|---|
qwen3-vl-2b-thinking-abliterated.safetensors | SafeTensors | 4.0GB | Transformers, PyTorch |
qwen3-vl-2b-thinking-abliterated-f16.gguf | GGUF FP16 | 3.3GB | llama.cpp, Ollama |
1from transformers import Qwen2VLForConditionalGeneration, AutoProcessor
2from PIL import Image
3import torch
4
5# Load model and processor
6model_path = "E:/huggingface/qwen3-vl-2b-thinking"
7model = Qwen2VLForConditionalGeneration.from_pretrained(
8 model_path,
9 torch_dtype=torch.float16,
10 device_map="auto"
11)
12processor = AutoProcessor.from_pretrained(model_path)
13
14# Load image
15image = Image.open("image.jpg")
16
17# Create conversation
18messages = [
19 {
20 "role": "user",
21 "content": [
22 {"type": "image", "image": image},
23 {"type": "text", "text": "Describe this image in detail."}
24 ]
25 }
26]
27
28# Process and generate
29text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
30inputs = processor(text=[text], images=[image], return_tensors="pt").to("cuda")
31
32# Generate response
33with torch.no_grad():
34 outputs = model.generate(**inputs, max_new_tokens=256)
35response = processor.batch_decode(outputs, skip_special_tokens=True)[0]
36
37print(response)1# Download llama.cpp with vision support
2git clone https://github.com/ggerganov/llama.cpp
3cd llama.cpp
4make
5
6# Run inference with image
7./llama-cli \
8 --model "E:/huggingface/qwen3-vl-2b-thinking/qwen3-vl-2b-thinking-abliterated-f16.gguf" \
9 --image "image.jpg" \
10 --prompt "Describe this image:" \
11 --n-gpu-layers 32 \
12 --ctx-size 40961# Create Modelfile
2cat > Modelfile <<EOF
3FROM E:/huggingface/qwen3-vl-2b-thinking/qwen3-vl-2b-thinking-abliterated-f16.gguf
4PARAMETER temperature 0.7
5PARAMETER top_p 0.9
6EOF
7
8# Create Ollama model
9ollama create qwen3-vl-thinking -f Modelfile
10
11# Run interactive session
12ollama run qwen3-vl-thinking "Analyze this image: image.jpg"1# Detailed analysis with thinking mode
2messages = [
3 {
4 "role": "user",
5 "content": [
6 {"type": "image", "image": image},
7 {"type": "text", "text": "Think step-by-step and explain what's happening in this image."}
8 ]
9 }
10]
11
12# Model will provide detailed reasoning in its response1# Use 8-bit quantization
2model = Qwen2VLForConditionalGeneration.from_pretrained(
3 model_path,
4 load_in_8bit=True,
5 device_map="auto"
6)1# Resize large images
2from PIL import Image
3image = Image.open("large_image.jpg")
4image = image.resize((448, 448))1# Process multiple images efficiently
2images = [Image.open(f"image{i}.jpg") for i in range(4)]
3inputs = processor(images=images, text=prompts, return_tensors="pt")--n-gpu-layers 32 for GPU acceleration--ctx-size based on available VRAM--threads for CPU optimization1generation_config = {
2 "max_new_tokens": 256,
3 "temperature": 0.7,
4 "top_p": 0.9,
5 "do_sample": True,
6 "repetition_penalty": 1.1
7}
8
9outputs = model.generate(**inputs, **generation_config)1@misc{qwen3vl2b-thinking-abliterated,
2 title={Qwen3-VL-2B-Thinking-Abliterated},
3 author={Qwen Team and Community Contributors},
4 year={2025},
5 howpublished={\url{https://huggingface.co/Qwen}},
6 note={Abliterated vision-language model with enhanced reasoning}
7}