xjh666/medical-o1-qwen2.5-0.5b
16
🏥 Medical Qwen2.5-0.5B — 医疗问答 LoRA
基于 Qwen2.5-0.5B-Instruct 使用 Unsloth + QLoRA 微调的医疗推理问答模型。
在 RTX 3050 (4GB VRAM) 上训练完成。模型学会了先进行 <think> 推理链思考,再给出最终答案。
📊 训练结果
🚀 使用方法
from unsloth import FastLanguageModel
import torch
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="xjh666/medical-o1-qwen2.5-0.5b", # 本 LoRA 适配器
max_seq_length=1024,
dtype=None,
load_in_4bit=True,
)
FastLanguageModel.for_inference(model)
messages = [
{"role": "user", "content": "A 45-year-old man presents with chest pain and shortness of breath. What is the most likely diagnosis?"},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_tensors="pt",
).to("cuda")
outputs = model.generate(input_ids=inputs, max_new_tokens=512, temperature=0.1, top_p=0.9)
print(tokenizer.decode(outputs[0][inputs.shape[1]:], skip_special_tokens=True))📂 仓库内容
- 主分支:LoRA 适配器 (
~45MB),需要配合基座模型unsloth/Qwen2.5-0.5B-Instruct-bnb-4bit使用 - `merged_16bit/`:完整 16-bit 合并权重 (
~954MB),可直接推理(不含 LoRA 依赖)
📖 训练数据
FreedomIntelligence/medical-o1-reasoning-SFT (英文子集) 包含医学问答 + 复杂推理链(Complex CoT),格式为 <think>推理</think>答案
⚙️ 训练参数
🖥️ 硬件环境
- GPU:NVIDIA GeForce RTX 3050 Laptop GPU (4GB VRAM)
- PyTorch:2.10.0+cu130
- CUDA:8.6 (Compute Capability) / Toolkit 13.0
- Unsloth:2026.6.9
📜 License
MIT
📖 引用
@misc{chen2024huatuogpto1medicalcomplexreasoning,
title={HuatuoGPT-o1, Towards Medical Complex Reasoning with LLMs},
author={Junying Chen and Zhenyang Cai and Ke Ji and Xidong Wang and Wanlong Liu and Rongsheng Wang and Jianye Hou and Benyou Wang},
year={2024},
eprint={2412.18925},
archivePrefix={arXiv},
}