Views
No views yet
| Base model | Qwen/Qwen2.5-VL-7B-Instruct (Apache-2.0) |
| Method | QLoRA — 4-bit NF4 + LoRA on language-side q/k/v/o_proj |
| LoRA | r=16, α=16, dropout=0.05, bias=none |
| Vision encoder | frozen (language side only adapted) |
| Dataset | 4014 train + 695 val examples (persona + screenshot → monologue) |
| Epochs | 3 (752 grad-update steps, effective batch 16) |
| LR | 2e-4, cosine, 1% warmup |
| Optimizer | paged_adamw_8bit |
| Precision | bf16 compute, 4-bit base weights |
| Sequence length | 4096 |
| Hardware | 1× NVIDIA A10G 24 GB (ml.g5.2xlarge, AWS SageMaker, ap-south-1) |
| Wall clock | 6h 5min |
transformers 4.56.2 + trl 1.4 + peft 0.19 + bitsandbytes + acceleratept-2.8.0/tf-4.56.2/py312)| Metric | Value |
|---|---|
| Final train loss | 1.11 (from 7.84 at step 10) |
| Final eval loss | 1.127 (from 1.192 at first eval) |
| Eval mean token accuracy | 0.841 → 0.852 |
| Grad-norm median / max | 0.12 / 0.97 (clip threshold 1.0 — never engaged) |
1from transformers import AutoModelForImageTextToText, AutoProcessor
2from peft import PeftModel
3import torch
4
5BASE = "Qwen/Qwen2.5-VL-7B-Instruct"
6ADAPTER = "dechrone/apriori-sft-v2-qwen25vl-7b"
7
8processor = AutoProcessor.from_pretrained(BASE)
9model = AutoModelForImageTextToText.from_pretrained(
10 BASE, dtype=torch.bfloat16, device_map="auto"
11)
12model = PeftModel.from_pretrained(model, ADAPTER)
13model.eval()
14
15messages = [
16 {"role": "system", "content": "You are simulating a real person mid-task on a product. ..."},
17 {"role": "user", "content": [
18 {"type": "image", "image": pil_screenshot},
19 {"type": "text", "text": "WHO YOU ARE: ... WHAT YOU'RE ABOUT TO DO: ..."},
20 ]},
21]
22text = processor.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
23inputs = processor(text=[text], images=[[pil_screenshot]], return_tensors="pt").to(model.device)
24
25with torch.no_grad():
26 out = model.generate(**inputs, max_new_tokens=80, do_sample=True, temperature=0.85)
27print(processor.batch_decode(out[:, inputs["input_ids"].shape[1]:], skip_special_tokens=True)[0])