Qwen3.5 2B MedVL

提供商OpenMed
分类visual-question-answering
许可证apache-2.0
下载量388
星标3

简介

Qwen3.5 2B MedVL 是一款基于通义千问架构、专注于医疗视觉问答(VQA)的轻量级多模态模型。它通过在医学影像数据集上的深度微调,能够理解 X 光片、CT 等医学图像并回答相关专业问题。由于参数量仅 2B,该模型在保证医疗专业性的同时,极大地降低了部署门槛,非常适合需要私有化部署、对推理延迟要求较高,或是在医疗终端设备上运行的开发者。它并非通用视觉模型,而是将能力聚焦在医疗垂直领域,是构建智能辅助诊疗系统的理想组件。

核心亮点

  • 深耕医疗 VQA,精准解析医学影像内容
  • 2B 轻量化参数,支持低成本私有化部署
  • 基于 Qwen 架构,中文指令遵循能力出色
  • Apache-2.0 协议,商业应用灵活无压力

使用方法

安装依赖
# 安装 Hugging Face transformers
pip install transformers torch
SDK 使用
# 使用 transformers 加载模型
from transformers import AutoModel, AutoTokenizer

model = AutoModel.from_pretrained("OpenMed/Qwen3.5-2B-MedVL")
tokenizer = AutoTokenizer.from_pretrained("OpenMed/Qwen3.5-2B-MedVL")

Hugging Face 下载

我们推荐使用命令行或者 Hugging Face Hub SDK 来进行模型的下载。

操作指引:在下载前,请先通过如下命令安装 huggingface_hub:

操作指引
pip install -U huggingface_hub

命令行下载

下载完整模型库

下载完整模型库
huggingface-cli download OpenMed/Qwen3.5-2B-MedVL

下载单个文件到指定本地文件夹(以下载 config.json 到当前路径下 ./dir 目录为例)

下载单个文件到指定本地文件夹(以下载 config.json 到当前路径下 ./dir 目录为例)
huggingface-cli download OpenMed/Qwen3.5-2B-MedVL config.json --local-dir ./dir

更多命令行下载选项,可参见官方文档

SDK 下载

SDK 下载
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('OpenMed/Qwen3.5-2B-MedVL')

Git 下载

请确保 lfs 已经被正确安装

Git 下载
git lfs install
git clone https://huggingface.co/OpenMed/Qwen3.5-2B-MedVL

如果您希望跳过 lfs 大文件下载,可以使用如下命令

跳过 LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/OpenMed/Qwen3.5-2B-MedVL

模型文件托管在 Hugging Face Hub,使用 HF CLI / SDK / Git 直接下载,不经过本站。

PyTorch / Transformers 使用

安装 Transformers

安装 Transformers
pip install -U transformers torch

模型加载和推理

模型加载和推理
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained('OpenMed/Qwen3.5-2B-MedVL')
tokenizer = AutoTokenizer.from_pretrained('OpenMed/Qwen3.5-2B-MedVL')

模型下载

我们推荐使用命令行或者 ModelScope SDK 来进行模型的下载。

操作指引:在下载前,请先通过如下命令安装 ModelScope:

操作指引
pip install modelscope

命令行下载

下载完整模型库

下载完整模型库
modelscope download --model OpenMed/Qwen3.5-2B-MedVL

下载单个文件到指定本地文件夹(以下载 README.md 到当前路径下 dir 目录为例)

下载单个文件到指定本地文件夹(以下载 README.md 到当前路径下 dir 目录为例)
modelscope download --model OpenMed/Qwen3.5-2B-MedVL README.md --local_dir ./dir

更多更丰富的命令行下载选项,可参见具体文档

SDK 下载

SDK 下载
# 模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('OpenMed/Qwen3.5-2B-MedVL')

Git 下载

请确保 lfs 已经被正确安装

Git 下载
git lfs install
git clone https://www.modelscope.cn/OpenMed/Qwen3.5-2B-MedVL.git

如果您希望跳过 lfs 大文件下载,可以使用如下命令

跳过 LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://www.modelscope.cn/OpenMed/Qwen3.5-2B-MedVL.git

ModelScope 模型页直接下载模型文件;无需将模型文件放在本站服务器。

Notebook 快速开发

下载并安装 ModelScope library

下载并安装 ModelScope library
pip install "modelscope[audio,cv,nlp,multi-modal,science]" -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html

模型加载和推理

模型加载和推理
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

p = pipeline('text-generation', 'OpenMed/Qwen3.5-2B-MedVL')

完整文档

来源: HuggingFace

---
license: apache-2.0
base_model: Qwen/Qwen3.5-2B
tags:
- medical
- vqa
- qwen3.5
- synthvision
pipeline_tag: visual-question-answering
---

Qwen3.5-2B-MedVL

!SynthVision

Qwen3.5-2B fine-tuned on ~200K medical VQA records from the SynthVision pipeline. Best overall model in the SynthVision family.

> Note: Requires transformers>=5.3.0. Do NOT install fla (crashes on Python 3.10).

Benchmark Results (Exact Match)

| Split | VQA-RAD | PathVQA | SLAKE | Avg EM |
|-------|---------|---------|-------|--------|
| Base (Qwen3.5-2B) | 0.5477 | 0.3822 | 0.5617 | 0.4972 |
| Fine-tuned | 0.5521 | 0.4748 | 0.6880 | 0.5716 |
| Delta | +0.8% | +24.2% | +22.5% | +15.0% |

Usage

Transformers

python
from transformers import AutoProcessor, AutoModelForImageTextToText

Requires transformers>=5.3.0

model_id = "OpenMed/Qwen3.5-2B-MedVL" processor = AutoProcessor.from_pretrained(model_id) model = AutoModelForImageTextToText.from_pretrained(model_id, torch_dtype="auto", device_map="auto")

messages = [
{
"role": "user",
"content": [
{"type": "image", "url": "https://example.com/xray.jpg"},
{"type": "text", "text": "What are the key findings in this chest X-ray?"},
],
}
]

inputs = processor.apply_chat_template(messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt").to(model.device)
output = model.generate(inputs, max_new_tokens=512)
print(processor.decode(output[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))

vLLM

python
from vllm import LLM, SamplingParams

llm = LLM(model="OpenMed/Qwen3.5-2B-MedVL", max_model_len=4096, limit_mm_per_prompt={"image": 1})

messages = [{"role": "user", "content": [
{"type": "image_url", "image_url": {"url": "https://example.com/xray.jpg"}},
{"type": "text", "text": "What are the key findings in this chest X-ray?"},
]}]

output = llm.chat(messages, SamplingParams(temperature=0, max_tokens=512))
print(output[0].outputs[0].text)

SGLang

bash
# Launch server
python -m sglang.launch_server --model-path OpenMed/Qwen3.5-2B-MedVL --port 8000
python
from openai import OpenAI

client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
response = client.chat.completions.create(
model="OpenMed/Qwen3.5-2B-MedVL",
messages=[{"role": "user", "content": [
{"type": "image_url", "image_url": {"url": "https://example.com/xray.jpg"}},
{"type": "text", "text": "What are the key findings in this chest X-ray?"},
]}],
max_tokens=512,
)
print(response.choices[0].message.content)

Training Details

  • Method: LoRA (rank=64, alpha=64)
  • Target modules: q_proj, v_proj, k_proj, o_proj, gate_proj, up_proj, down_proj
  • Learning rate: 1e-4, cosine schedule
  • Steps: 350
  • Weight decay: 0.01
  • Training time**: ~1h

Links