Downloads · 30 days
0
xueh88401/qwen2.5-7b-medical
qwen2.5-7b-medical is a machine learning model from xueh88401. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
使用 QLoRA 技术在 QiZhenGPT 医疗数据集上对 Qwen2.5-7B-Instruct 进行指令微调,提升其在医疗问答中的专业性和准确性。
Downloads · 30 days
0
Access
Public
Updated Dec 12, 2025
Repo size
80.8 MB
Likes
0
Public
Click a slice to open those files.
.safetensors80.8 MB · 96%
From the Hugging Face model README
使用 QLoRA 技术在 QiZhenGPT 医疗数据集上对 Qwen2.5-7B-Instruct 进行指令微调,提升其在医疗问答中的专业性和准确性。
本仓库提供的是 LoRA 适配器权重,需要与基础模型 Qwen/Qwen2.5-7B-Instruct 结合使用。
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
# 加载基础模型
model = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen2.5-7B-Instruct",
torch_dtype=torch.float16,
device_map="auto"
)
# 加载本 LoRA 适配器
model = PeftModel.from_pretrained(model, "xueh88401/qwen2.5-7b-medical")
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-7B-Instruct")
# 进行推理
inputs = tokenizer("用户:感冒了怎么办?\n助手:", return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=200)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))