Views
No views yet

Qwen3-VL-2B-Instruct-abliterated is an abliterated (v1.0) variant of Qwen3-VL-2B-Instruct, designed for Abliterated Reasoning and Captioning. This model is optimized to generate detailed, descriptive captions and reasoning outputs across a wide range of visual and multimodal contexts—including complex, sensitive, or nuanced content—while supporting diverse aspect ratios and resolutions.

1from transformers import Qwen3VLForConditionalGeneration, AutoProcessor
2from qwen_vl_utils import process_vision_info
3import torch
4
5model = Qwen3VLForConditionalGeneration.from_pretrained(
6 "prithivMLmods/Qwen3-VL-2B-Instruct-abliterated",
7 torch_dtype="auto",
8 device_map="auto"
9)
10
11processor = AutoProcessor.from_pretrained("prithivMLmods/Qwen3-VL-2B-Instruct-abliterated")
12
13messages = [
14 {
15 "role": "user",
16 "content": [
17 {
18 "type": "image",
19 "image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",
20 },
21 {"type": "text", "text": "Provide a detailed caption and reasoning for this image."},
22 ],
23 }
24]
25
26text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
27image_inputs, video_inputs = process_vision_info(messages)
28
29inputs = processor(
30 text=[text],
31 images=image_inputs,
32 videos=video_inputs,
33 padding=True,
34 return_tensors="pt",
35).to("cuda")
36
37generated_ids = model.generate(**inputs, max_new_tokens=128)
38generated_ids_trimmed = [out[len(inp):] for inp, out in zip(inputs.input_ids, generated_ids)]
39
40output_text = processor.batch_decode(
41 generated_ids_trimmed,
42 skip_special_tokens=True,
43 clean_up_tokenization_spaces=False
44)
45print(output_text)