🚀 Medichat-Llama3-8B
Medichat-Llama3-8B 基於強大的 LLaMa - 3 架構構建,並在大量健康信息數據集上進行了微調。該模型憑藉其豐富的醫學知識,能夠提供清晰、全面的答案,尤其適合那些尋求深入醫療建議的用戶,能給出準確且有價值的回覆。
✨ 主要特性
- 基於強大的 LLaMa - 3 架構,擁有豐富的醫學知識儲備。
- 在大量健康信息數據集上進行微調,能提供準確、全面的醫療相關回答。
- 相比之前的模型,在特定學科知識和準確性上有顯著提升。
📦 安裝指南
文檔未提供具體安裝步驟,暫不展示。
💻 使用示例
基礎用法
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
class MedicalAssistant:
def __init__(self, model_name="sethuiyer/Medichat-Llama3-8B", device="cuda"):
self.device = device
self.tokenizer = AutoTokenizer.from_pretrained(model_name)
self.model = AutoModelForCausalLM.from_pretrained(model_name).to(self.device)
self.sys_message = '''
You are an AI Medical Assistant trained on a vast dataset of health information. Please be thorough and
provide an informative answer. If you don't know the answer to a specific medical inquiry, advise seeking professional help.
'''
def format_prompt(self, question):
messages = [
{"role": "system", "content": self.sys_message},
{"role": "user", "content": question}
]
prompt = self.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
return prompt
def generate_response(self, question, max_new_tokens=512):
prompt = self.format_prompt(question)
inputs = self.tokenizer(prompt, return_tensors="pt").to(self.device)
with torch.no_grad():
outputs = self.model.generate(**inputs, max_new_tokens=max_new_tokens, use_cache=True)
answer = self.tokenizer.batch_decode(outputs, skip_special_tokens=True)[0].strip()
return answer
if __name__ == "__main__":
assistant = MedicalAssistant()
question = '''
Symptoms:
Dizziness, headache, and nausea.
What is the differential diagnosis?
'''
response = assistant.generate_response(question)
print(response)
📚 詳細文檔
模型基礎信息
屬性 |
詳情 |
基礎模型 |
Undi95/Llama - 3 - Unholy - 8B、Locutusque/llama - 3 - neural - chat - v1 - 8b、ruslanmv/Medical - Llama3 - 8B - 16bit |
庫名稱 |
transformers |
標籤 |
mergekit、merge、medical |
許可證 |
other |
訓練數據集 |
mlabonne/orpo - dpo - mix - 40k、Open - Orca/SlimOrca - Dedup、jondurbin/airoboros - 3.2、microsoft/orca - math - word - problems - 200k、m - a - p/Code - Feedback、MaziyarPanahi/WizardLM_evol_instruct_V2_196k、ruslanmv/ai - medical - chatbot |
模型構建配置
以下是用於生成此模型的 YAML 配置:
models:
- model: Undi95/Llama-3-Unholy-8B
parameters:
weight: [0.25, 0.35, 0.45, 0.35, 0.25]
density: [0.1, 0.25, 0.5, 0.25, 0.1]
- model: Locutusque/llama-3-neural-chat-v1-8b
- model: ruslanmv/Medical-Llama3-8B-16bit
parameters:
weight: [0.55, 0.45, 0.35, 0.45, 0.55]
density: [0.1, 0.25, 0.5, 0.25, 0.1]
merge_method: dare_ties
base_model: Locutusque/llama-3-neural-chat-v1-8b
parameters:
int8_mask: true
dtype: bfloat16
與 Dr.Samantha 7B 模型對比
學科 |
Medichat - Llama3 - 8B 準確率 (%) |
Dr. Samantha 準確率 (%) |
臨床知識 |
71.70 |
52.83 |
醫學遺傳學 |
78.00 |
49.00 |
人類衰老 |
70.40 |
58.29 |
人類性學 |
73.28 |
55.73 |
大學醫學 |
62.43 |
38.73 |
解剖學 |
64.44 |
41.48 |
大學生物學 |
72.22 |
52.08 |
高中生物學 |
77.10 |
53.23 |
專業醫學 |
63.97 |
38.73 |
營養學 |
73.86 |
50.33 |
專業心理學 |
68.95 |
46.57 |
病毒學 |
54.22 |
41.57 |
高中心理學 |
83.67 |
66.60 |
平均 |
70.33 |
48.85 |
當前模型在特定學科知識和準確性方面相較於之前的 Dr. Samantha 模型有顯著提升。
量化版本
感謝 Quant Factory,該模型的量化版本可在 QuantFactory/Medichat - Llama3 - 8B - GGUF 獲取。
Ollama 使用
此模型現在也可在 Ollama 上使用。你可以在終端中運行命令 ollama run monotykamary/medichat-llama3
來使用它。如果你計算資源有限,可以查看這個 視頻 學習如何在 Google Colab 後端運行該模型。
🔧 技術細節
文檔未提供具體技術細節,暫不展示。
📄 許可證
該模型使用的許可證為 other。