VReason-QwenVL model checkpoint for chest X-ray visual reasoning and report generation.
1pip install -r requirements.txt
2pip install cxas-vreason
1import torch
2from PIL import Image
3from transformers import AutoProcessor, AutoModelForVision2Seq
4
5repo_id = "EvidenceAIResearch/VReason-QwenVL"
6processor = AutoProcessor.from_pretrained(repo_id, trust_remote_code=True)
7model = AutoModelForVision2Seq.from_pretrained(
8 repo_id,
9 torch_dtype=torch.float16,
10 trust_remote_code=True,
11).eval().cuda()
12
13image = Image.open("frontal.jpg").convert("RGB")
14messages = [
15 {
16 "role": "user",
17 "content": [
18 {"type": "image", "image": image},
19 {
20 "type": "text",
21 "text": "Based on the provided chest radiograph, explain your diagnosis procedure and write a report.",
22 },
23 ],
24 }
25]
26
27prompt = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
28inputs = processor(text=[prompt], images=[[image]], return_tensors="pt").to(model.device)
29output_ids = model.generate(**inputs, max_new_tokens=1024)
30text = processor.batch_decode(output_ids, skip_special_tokens=False)[0]
31print(text)
1out = model.visual_reason(
2 processor=processor,
3 image="frontal.jpg",
4 generate_roi=True,
5 output_dir="./visual_reason_out",
6 viz_mode="blurcrop",
7)
8print(out["report"])
1@unpublished{ye2026visual,
2 title={Visual Reasoning Enables Evidence-Grounded Radiology {AI}},
3 author={Ye, Shuchang and Robertson, Harry and Moghadam, Alireza
4 and Shu, Matthew and Harb, Nathan and Li, Jennifer
5 and Mogdil, Aadhar and Raythatha, Jineel and Shen, Yujia
6 and Song, Xinyun and Tan, Xinchen and Fu, Xiaolong
7 and Meng, Mingyuan and Bi, Lei and Yang, Jean YH
8 and Kim, Jinman},
9 year={2026},
10}