Medichat V2 Llama3 8B
模型概述
這是一個預訓練語言模型合併版本,特別擅長處理結構化/非結構化臨床文本,提供專業的醫學問答服務
模型特點
醫學專業能力
通過合併專業醫學模型,具備處理複雜醫學問題的能力
多模型融合
採用DARE TIES方法合併多個專業模型,平衡醫學專業性和通用能力
結構化輸出
支持生成結構化醫療數據(如JSON格式的診斷報告)
模型能力
醫學問答
症狀分析
鑑別診斷
臨床文本處理
結構化醫療數據生成
使用案例
臨床輔助
症狀分析
根據患者描述的症狀提供可能的鑑別診斷
生成包含多種可能診斷的詳細分析報告
實驗室結果解讀
解析實驗室檢查數據並生成診斷建議
結構化輸出診斷結果和相關醫學解釋
醫學教育
醫學知識問答
回答醫學生或從業者的專業問題
提供準確、詳細的醫學知識解釋
🚀 Medichat-V2-Llama3-8B
Medichat-V2-Llama3-8B 是一個基於預訓練語言模型融合而成的模型,藉助 mergekit 工具創建。該模型在處理非結構化臨床文本的結構化任務上表現出色,能有效提升醫療文本處理的效率和準確性。
✨ 主要特性
模型構成與特點
- 基礎模型:此模型以 "refuelai/Llama-3-Refueled" 為基礎,它是 Llama3 - 8B 模型的優化版本,具備出色的指令遵循能力,能靈活適應不同領域的任務。
- 融合模型:
- ruslanmv/ai - medical - model - 32bit:專門針對醫學技術問題進行微調訓練,為模型提供了堅實的醫學知識基礎。
- Locutusque/Llama - 3 - Hercules - 5.0 - 8B:擅長遵循複雜指令,在科學和技術對話場景中表現優異,能有效處理各類對話交互。
融合方法
本模型採用 DARE TIES 融合方法,以 [refuelai/Llama - 3 - Refueled](https://huggingface.co/refuelai/Llama - 3 - Refueled) 為基礎進行融合。
融合模型列表
以下模型參與了融合:
- [ruslanmv/ai - medical - model - 32bit](https://huggingface.co/ruslanmv/ai - medical - model - 32bit)
- [Locutusque/Llama - 3 - Hercules - 5.0 - 8B](https://huggingface.co/Locutusque/Llama - 3 - Hercules - 5.0 - 8B)
配置信息
以下是用於生成此模型的 YAML 配置:
models:
- model: Locutusque/Llama-3-Hercules-5.0-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: refuelai/Llama-3-Refueled
- model: ruslanmv/ai-medical-model-32bit
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: refuelai/Llama-3-Refueled
parameters:
int8_mask: true
dtype: bfloat16
📦 安裝指南
文檔未提供具體安裝步驟,可參考相關依賴庫(如 transformers
)的官方文檔進行安裝。
💻 使用示例
基礎用法
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
class MedicalAssistant:
def __init__(self, model_name="sethuiyer/Medichat-V2-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
assistant = MedicalAssistant()
question = '''
Symptoms:
Dizziness, headache, and nausea.
What is the differential diagnosis?
'''
response = assistant.generate_response(question)
print(response)
Based on the symptoms of dizziness, headache, and nausea, the differential diagnosis could include several conditions. Here are some possible causes:
1. Vestibular disorders: These can cause dizziness, vertigo, and nausea. Examples include benign paroxysmal positional vertigo (BPPV), labyrinthitis, and vestibular neuritis.
2. Migraine: Migraines can cause severe headaches, nausea, and dizziness. They can be triggered by various factors, such as stress, changes in sleep patterns, or certain foods.
3. Inner ear infections: Infections in the inner ear, such as labyrinthitis or otitis media, can cause dizziness, nausea, and headache.
4. Meniere's disease: This is a disorder of the inner ear that can cause episodes of vertigo, nausea, and hearing loss.
5. Motion sickness: This can occur when the body receives conflicting signals from the eyes, inner ear, and other sensory systems. It can cause dizziness, nausea, and headache.
6. Anxiety or panic attacks: Anxiety or panic attacks can cause dizziness, nausea, and headache.
7. Low blood sugar (hypoglycemia): Low blood sugar can cause dizziness, headache, and nausea.
8. Medication side effects: Certain medications, such as antibiotics, antihistamines, and antidepressants, can cause dizziness, headache, and nausea as side effects.
9. Stroke or transient ischemic attack (TIA): These can cause sudden onset of dizziness, headache, and nausea.
10. Brain tumor or other central nervous system disorders: Rarely, a brain tumor or other central nervous system disorder can cause dizziness, headache, and nausea.
It is essential to consult a healthcare professional for a proper evaluation and diagnosis. They will likely perform a physical examination, take a detailed medical history, and order appropriate tests to determine the underlying cause of the symptoms. Treatment will depend on the specific diagnosis and may include medications, lifestyle changes, or other interventions.
高級用法
prompt = '''
A 52-year-old woman comes to the physician because of a 6-month history of generalized fatigue, low-grade fever, and a 10-kg (22-lb) weight loss. Physical examination shows generalized pallor and splenomegaly. Her hemoglobin concentration is 7.5 g/dL and leukocyte count is 41,800/mm3. Leukocyte alkaline phosphatase activity is low. Peripheral blood smear shows basophilia with myelocytes and metamyelocytes. Bone marrow biopsy shows cellular hyperplasia with proliferation of immature granulocytic cells. Which of the following mechanisms is most likely responsible for this patient's condition?
Output JSON in this format.
{
"age":
"gender"
"past medicial history"
"present symptoms"
"interventions"
"lab tests"
"medications"
"possible diseases"
}
PLEASE WRITE ONLY JSON
'''
response = assistant.generate_response(prompt)
print(response)
{
"age": 52,
"gender": "female",
"past medical history": "unknown",
"present symptoms": "generalized fatigue, low-grade fever, 10-kg (22-lb) weight loss",
"interventions": "bone marrow biopsy",
"lab tests": "hemoglobin concentration: 7.5 g/dL, leukocyte count: 41,800/mm3, leukocyte alkaline phosphatase activity: low, peripheral blood smear: basophilia with myelocytes and metamyelocytes",
"medications": "none",
"possible diseases": "chronic myeloid leukemia"
}
📚 詳細文檔
量化版本
本模型的量化版本可在 [mradermacher/Medichat - V2 - Llama3 - 8B - GGUF](https://huggingface.co/mradermacher/Medichat - V2 - Llama3 - 8B - GGUF) 找到。
📄 許可證
本模型使用的許可證為 other。
屬性 | 詳情 |
---|---|
模型類型 | 基於預訓練語言模型融合的醫療模型 |
訓練數據 | ruslanmv/ai - medical - chatbot、Locutusque/hercules - v5.0 |
基礎模型 | ruslanmv/ai - medical - model - 32bit、Locutusque/Llama - 3 - Hercules - 5.0 - 8B、refuelai/Llama - 3 - Refueled |
庫名稱 | transformers |
標籤 | mergekit、merge、medical |
語言 | en |
Phi 2 GGUF
其他
Phi-2是微軟開發的一個小型但強大的語言模型,具有27億參數,專注於高效推理和高質量文本生成。
大型語言模型 支持多種語言
P
TheBloke
41.5M
205
Roberta Large
MIT
基於掩碼語言建模目標預訓練的大型英語語言模型,採用改進的BERT訓練方法
大型語言模型 英語
R
FacebookAI
19.4M
212
Distilbert Base Uncased
Apache-2.0
DistilBERT是BERT基礎模型的蒸餾版本,在保持相近性能的同時更輕量高效,適用於序列分類、標記分類等自然語言處理任務。
大型語言模型 英語
D
distilbert
11.1M
669
Llama 3.1 8B Instruct GGUF
Meta Llama 3.1 8B Instruct 是一個多語言大語言模型,針對多語言對話用例進行了優化,在常見的行業基準測試中表現優異。
大型語言模型 英語
L
modularai
9.7M
4
Xlm Roberta Base
MIT
XLM-RoBERTa是基於100種語言的2.5TB過濾CommonCrawl數據預訓練的多語言模型,採用掩碼語言建模目標進行訓練。
大型語言模型 支持多種語言
X
FacebookAI
9.6M
664
Roberta Base
MIT
基於Transformer架構的英語預訓練模型,通過掩碼語言建模目標在海量文本上訓練,支持文本特徵提取和下游任務微調
大型語言模型 英語
R
FacebookAI
9.3M
488
Opt 125m
其他
OPT是由Meta AI發佈的開放預訓練Transformer語言模型套件,參數量從1.25億到1750億,旨在對標GPT-3系列性能,同時促進大規模語言模型的開放研究。
大型語言模型 英語
O
facebook
6.3M
198
1
基於transformers庫的預訓練模型,適用於多種NLP任務
大型語言模型
Transformers

1
unslothai
6.2M
1
Llama 3.1 8B Instruct
Llama 3.1是Meta推出的多語言大語言模型系列,包含8B、70B和405B參數規模,支持8種語言和代碼生成,優化了多語言對話場景。
大型語言模型
Transformers 支持多種語言

L
meta-llama
5.7M
3,898
T5 Base
Apache-2.0
T5基礎版是由Google開發的文本到文本轉換Transformer模型,參數規模2.2億,支持多語言NLP任務。
大型語言模型 支持多種語言
T
google-t5
5.4M
702
精選推薦AI模型
Llama 3 Typhoon V1.5x 8b Instruct
專為泰語設計的80億參數指令模型,性能媲美GPT-3.5-turbo,優化了應用場景、檢索增強生成、受限生成和推理任務
大型語言模型
Transformers 支持多種語言

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一個基於SODA數據集訓練的超小型對話模型,專為邊緣設備推理設計,體積僅為Cosmo-3B模型的2%左右。
對話系統
Transformers 英語

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基於RoBERTa架構的中文抽取式問答模型,適用於從給定文本中提取答案的任務。
問答系統 中文
R
uer
2,694
98