🚀 Medichat-Llama3-8B
このモデルは強力なLLaMa - 3アーキテクチャをベースに構築され、豊富な健康情報データセットで微調整されています。広範な医学知識を活用して、明確で包括的な回答を提供します。
このモデルは、特に詳細な医学的アドバイスを求めるユーザーにとって、正確で有益な応答を提供するのに適しています。
📚 ドキュメント
モデル情報
属性 |
詳情 |
モデルタイプ |
Medichat-Llama3-8B |
ベースモデル |
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設定
このモデルを生成するために使用された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モデルよりも大幅な改善を示しています。
💻 使用例
基本的な使用法
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)
🔧 その他情報
量子化モデル
Quant Factoryのおかげで、このモデルの量子化バージョンはQuantFactory/Medichat-Llama3-8B-GGUFで利用可能です。
Ollamaでの使用
このモデルはOllamaでも利用できます。ターミナルでollama run monotykamary/medichat-llama3
というコマンドを実行することで使用できます。計算リソースが限られている場合は、このビデオを見て、Google Colabバックエンドで実行する方法を学ぶことができます。
📄 ライセンス
このモデルのライセンスはotherです。