import torchfrom PIL import Imagefrom transformers import AutoModelForVision2Seq, AutoProcessorfrom peft import PeftModel BASE = "Qwen/Qwen3-VL-2B-Instruct"ADAPTER = "shravvvv/VISE" model = AutoModelForVision2Seq.from_pretrained(BASE, torch_dtype=torch.bfloat16, device_map="auto")model = PeftModel.from_pretrained(model, ADAPTER)processor = AutoProcessor.from_pretrained(ADAPTER)model.eval() image = Image.open("example.jpg").convert("RGB")messages = [{"role": "user", "content": [ {"type": "image", "image": image}, {"type": "text", "text": "Describe this image in detail."},]}]text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)inputs = processor(text=[text], images=[image], return_tensors="pt").to(model.device) with torch.inference_mode(): out = model.generate(**inputs, max_new_tokens=128)print(processor.batch_decode(out[:, inputs["input_ids"].shape[1]:], skip_special_tokens=True)[0])