🚀 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:提供了模型託管服務。