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