Downloads · 30 days
0
Lyzlon/qwen3-vl-8b-medical-lora
qwen3-vl-8b-medical-lora is a image-text-to-text model from Lyzlon. Use it for the image-text-to-text task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
本模型基于Qwen3-VL-8B-Instruct进行两阶段微调,分为SFT与DPO两阶段,通过SFT规范模型行为,在此基础上进一步通过医疗领域人类偏好数据对齐模型输出,降低医学影像问答幻觉、规范临床专业表述。
Downloads · 30 days
0
Access
Public
Updated Jul 1, 2026
Repo size
1 GB
Likes
2
Public
Click a slice to open those files.
.pt699 MB · 67%
From the Hugging Face model README
本模型基于Qwen3-VL-8B-Instruct进行两阶段微调,分为SFT与DPO两阶段,通过SFT规范模型行为,在此基础上进一步通过医疗领域人类偏好数据对齐模型输出,降低医学影像问答幻觉、规范临床专业表述。
基础模型: Qwen3-VL-8B-Instruct
训练阶段: SFT + DPO
训练状态: 已完成
主图文医学数据集:SLAKE、VQA-RAD(用于SFT基础训练)
偏好对齐数据集: Medical-ChatBot-DPO
详细数据集信息请查看上述链接。
MS-Swift: 统一微调、推理框架
PEFT: QLoRA参数微调
BitsAndBytes: 4-bit
Flash Attention 2: 加速注意力计算
Cosine 学习率调度 + Warmup
Gradient Checkpointing 显存优化
--num_train_epochs 2
--per_device_train_batch_size 4
--gradient_accumulation_steps 2
--learning_rate 1e-4
--lora_rank 16
--lora_alpha 32
--target_modules all-linear
--quant_method bnb
--quant_bits 4
--max_length 3072
--save_steps 100
--eval_steps 100
--eval_strategy steps
--logging_steps 10
--warmup_ratio 0.03
--lr_scheduler_type cosine
--torch_dtype bfloat16
--gradient_checkpointing true
--freeze_vit true
--freeze_aligner true
--dataloader_num_workers 4
--num_train_epochs 1
--per_device_train_batch_size 1
--gradient_accumulation_steps 8
--learning_rate 5e-5
--target_modules all-linear
--quant_method bnb
--quant_bits 4
--max_length 3072
--truncation_strategy right
--save_steps 500
--save_total_limit 2
--logging_steps 20
--warmup_ratio 0.03
--lr_scheduler_type cosine
--torch_dtype bfloat16
--gradient_checkpointing true
--freeze_vit true
--freeze_aligner true
SFT:
DPO:

pip install torch transformers peft accelerate ms-swift pillow
from swift.llm import get_model_tokenizer, inference
base_model = "Qwen/Qwen3-VL-8B-Instruct"
sft_lora = "Lyzlon/qwen3-vl-8b-medical-lora"
dpo_lora = "你的HF用户名/qwen3-vl-8b-medical-dpo-lora"
model, tokenizer = get_model_tokenizer(
model=base_model,
adapter_id=dpo_lora,
quantization_bit=4
)
# 医学影像问答
img_path = "你的X光/CT影像.jpg"
question = "请分析这张肺部胸片有无异常病灶"
response, _ = inference(model, tokenizer, query=question, images=[img_path])
print(response)
合并基座 + SFT+DPO LoRA 为完整权重,使用 vLLM 部署高性能 OpenAI 兼容 API;
FastAPI + Swift 原生加载 LoRA,自定义图文接口用于医学 Agent 开发;
Hugging Face Spaces Gradio 网页在线演示。
⚠️ 医疗免责声明:
本模型仅供研究和教育用途
不应作为专业医疗建议的替代
任何医疗决策都应咨询专业医疗人员
模型输出可能包含错误或不完整信息