🚀 DeepSeek-R1-Medical-CoT
本项目是对 deepseek-ai/DeepSeek-R1-Distill-Llama-8B
模型进行微调,旨在通过“思维链(CoT)”提示技术增强医疗推理能力。该模型使用 QLoRA 结合 Unsloth 优化进行训练,可在有限的硬件资源上实现高效微调。
🚀 快速开始
1️⃣ 加载模型
from transformers import AutoModelForCausalLM, AutoTokenizer
repo_name = "your-huggingface-username/DeepSeek-R1-Medical-CoT"
tokenizer = AutoTokenizer.from_pretrained(repo_name)
model = AutoModelForCausalLM.from_pretrained(repo_name)
model.eval()
2️⃣ 运行推理
prompt = "What are the early symptoms of diabetes?"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
output = model.generate(**inputs, max_new_tokens=200)
response = tokenizer.decode(output[0], skip_special_tokens=True)
print("Model Response:", response)
✨ 主要特性
- 基于
deepseek-ai/DeepSeek-R1-Distill-Llama-8B
进行微调,专注于医疗推理。
- 使用 Chain-of-Thought (CoT) 提示技术,增强医疗推理能力。
- 采用 QLoRA 结合 Unsloth 优化,可在有限硬件资源上高效微调。
📦 安装指南
文档未提及安装步骤,暂不提供。
💻 使用示例
基础用法
from transformers import AutoModelForCausalLM, AutoTokenizer
repo_name = "your-huggingface-username/DeepSeek-R1-Medical-CoT"
tokenizer = AutoTokenizer.from_pretrained(repo_name)
model = AutoModelForCausalLM.from_pretrained(repo_name)
model.eval()
高级用法
prompt = "What are the early symptoms of diabetes?"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
output = model.generate(**inputs, max_new_tokens=200)
response = tokenizer.decode(output[0], skip_special_tokens=True)
print("Model Response:", response)
📚 详细文档
模型详情
属性 |
详情 |
开发者 |
[Your Name or Organization] |
微调基础模型 |
deepseek-ai/DeepSeek-R1-Distill-Llama-8B |
语言 |
英语,专注于医学术语 |
训练数据 |
医学推理数据集 (medical-o1-reasoning-SFT ) |
微调方法 |
QLoRA(4 位适配器),后合并为 16 位权重 |
优化方式 |
Unsloth(微调速度提高 2 倍,内存使用更低) |
模型来源
- 仓库地址:[Your Hugging Face Model Repo URL]
- 论文(若有):[Link]
- 演示(若有):[Link]
🔧 技术细节
文档未提及技术细节,暂不提供。
📄 许可证
本模型使用 MIT 许可证。
📢 致谢
- DeepSeek-AI:发布了 DeepSeek-R1 模型。
- Unsloth:提供了优化的 LoRA 微调方法。
- Hugging Face:提供了模型托管服务。