Views
No views yet
1from unsloth import FastVisionModel
2from peft import PeftModel
3from PIL import Image
4
5# Load base model
6model, processor = FastVisionModel.from_pretrained(
7 "unsloth/Qwen3-VL-2B-Instruct",
8 load_in_4bit=True,
9 max_seq_length=2048,
10)
11
12# Load LoRA adapter
13model = PeftModel.from_pretrained(model, "sanskxr02/qwen3-vl-2b-affordance-checkpoint3500")
14FastVisionModel.for_inference(model)
15
16# Run inference
17image = Image.open("frame.jpg").convert("RGB").resize((384, 216))
18messages = [{
19 "role": "user",
20 "content": [
21 {"type": "image", "image": image},
22 {"type": "text", "text": "What is the affordance in this scene?"},
23 ],
24}]
25
26text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True, enable_thinking=False)
27inputs = processor(text=[text], images=[image], return_tensors="pt", padding=True).to(model.device)
28
29output_ids = model.generate(**inputs, max_new_tokens=20, temperature=0.0, do_sample=False)
30prediction = processor.tokenizer.decode(output_ids[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
31print(f"Affordance: {prediction}")adapter_config.json, adapter_model.safetensors - LoRA adapter weightscheckpoint-3500/ - Full checkpoint with trainer stateevaluation/ - Evaluation results with annotated images and training curvesdataset/ - Training data files (annotations, train/val splits)train.py, inference.py - Training and inference scripts1@model{qwen3vl_affordance_ckpt3500,
2 title={Qwen3-VL-2B Affordance Detection - Checkpoint 3500},
3 author={Kavin (sanskxr02)},
4 year={2026},
5 publisher={HuggingFace},
6 url={https://huggingface.co/sanskxr02/qwen3-vl-2b-affordance-checkpoint3500}
7}