Views
No views yet

| Split | VQA-RAD | PathVQA | SLAKE | Avg EM |
|---|---|---|---|---|
| Base (Qwen2.5-VL-3B-Instruct) | 0.5033 | 0.3038 | 0.5438 | 0.4503 |
| Fine-tuned | 0.5211 | 0.3468 | 0.6032 | 0.4903 |
| Delta | +3.5% | +14.2% | +10.9% | +8.9% |
1from transformers import AutoProcessor, AutoModelForImageTextToText
2
3model_id = "OpenMed/Qwen2.5-3B-MedVL"
4processor = AutoProcessor.from_pretrained(model_id)
5model = AutoModelForImageTextToText.from_pretrained(model_id, torch_dtype="auto", device_map="auto")
6
7messages = [
8 {
9 "role": "user",
10 "content": [
11 {"type": "image", "url": "https://example.com/xray.jpg"},
12 {"type": "text", "text": "What are the key findings in this chest X-ray?"},
13 ],
14 }
15]
16
17inputs = processor.apply_chat_template(messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt").to(model.device)
18output = model.generate(**inputs, max_new_tokens=512)
19print(processor.decode(output[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))1from vllm import LLM, SamplingParams
2
3llm = LLM(model="OpenMed/Qwen2.5-3B-MedVL", max_model_len=4096, limit_mm_per_prompt={"image": 1})
4
5messages = [{"role": "user", "content": [
6 {"type": "image_url", "image_url": {"url": "https://example.com/xray.jpg"}},
7 {"type": "text", "text": "What are the key findings in this chest X-ray?"},
8]}]
9
10output = llm.chat(messages, SamplingParams(temperature=0, max_tokens=512))
11print(output[0].outputs[0].text)1# Launch server
2python -m sglang.launch_server --model-path OpenMed/Qwen2.5-3B-MedVL --chat-template qwen2-vl --port 80001from openai import OpenAI
2
3client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
4response = client.chat.completions.create(
5 model="OpenMed/Qwen2.5-3B-MedVL",
6 messages=[{"role": "user", "content": [
7 {"type": "image_url", "image_url": {"url": "https://example.com/xray.jpg"}},
8 {"type": "text", "text": "What are the key findings in this chest X-ray?"},
9 ]}],
10 max_tokens=512,
11)
12print(response.choices[0].message.content)