🚀 MMedLM
本项目是用于医学领域的多语言语言模型,提供了官方模型权重,可用于医学问答等任务,在常见英文基准测试中表现出色。
🚀 快速开始
模型可以按如下方式加载:
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Henrychur/MMed-Llama-3-8B-EnIns")
model = AutoModelForCausalLM.from_pretrained("Henrychur/MMed-Llama-3-8B-EnIns", torch_dtype=torch.float16)
- 推理格式与 Llama 3-Instruct 类似,你可以在此处查看推理代码。
- 对于多项选择题和问答任务,建议使用以下指令:
from model import MedS_Llama3
sdk_api = MedS_Llama3(model_path="Henrychur/MMed-Llama-3-8B-EnIns", gpu_id=0)
INSTRUCTION = "Given a question and a list of options, select the correct answer from the options directly."
input_ = "Question: A mother brings her 3 - week - old infant to the pediatrician's office because she is concerned about his feeding habits. He was born without complications and has not had any medical problems up until this time. However, for the past 4 days, he has been fussy, is regurgitating all of his feeds, and his vomit is yellow in color. On physical exam, the child's abdomen is minimally distended but no other abnormalities are appreciated. Which of the following embryologic errors could account for this presentation?\nOptions: A: Abnormal migration of ventral pancreatic bud\tB: Complete failure of proximal duodenum to recanalize\tC: Abnormal hypertrophy of the pylorus\tD: Failure of lateral body folds to move ventrally and fuse in the midline\t"
results = sdk_api.chat([], input_, INSTRUCTION)
print(results)
✨ 主要特性
本仓库包含基于 MMed-Llama 3-8B 的 MMed-Llama 3-8B-EnIns。我们在英文指令微调数据集(来自 PMC-LLaMA)上对该模型进行了进一步微调,以便在常用的英文基准测试中与现有模型进行公平比较。
需要注意的是,MMed-Llama 3-8B-EnIns 仅在 pmc_llama_instructions 上进行了训练,这是一个专注于问答任务的英文医学 SFT 数据集。因此,该模型对多语言输入的响应能力仍然有限。
📚 详细文档
最新消息
- [2024.2.21] 我们的预印本论文在 ArXiv 上发布,你可以在此处查看研究结果。
- [2024.2.20] 我们发布了 MMedLM 和 MMedLM 2。通过在 MMedC 上进行自回归持续训练,这些模型与所有其他开源模型相比取得了更优的性能,甚至在 MMedBench 上可与 GPT - 4 相媲美。
- [2023.2.20] 我们发布了 MMedC,这是一个包含 255 亿个标记的多语言医学语料库。
- [2023.2.20] 我们发布了 MMedBench,这是一个新的带有推理依据的多语言医学多项选择题问答基准测试。你可以在此处查看排行榜。
常用英文基准测试评估
进一步预训练的 MMed-Llama3 在不同的英文基准测试的医学领域中也展现出了出色的性能。
方法 |
规模 |
年份 |
MedQA |
MedMCQA |
PubMedQA |
MMLU_CK |
MMLU_MG |
MMLU_AN |
MMLU_PM |
MMLU_CB |
MMLU_CM |
平均 |
MedAlpaca |
7B |
2023.3 |
41.7 |
37.5 |
72.8 |
57.4 |
69.0 |
57.0 |
67.3 |
65.3 |
54.3 |
58.03 |
PMC-LLaMA |
13B |
2023.9 |
56.4 |
56.0 |
77.9 |
- |
- |
- |
- |
- |
- |
- |
MEDITRON |
7B |
2023.11 |
57.2 |
59.2 |
74.4 |
64.6 |
59.9 |
49.3 |
55.4 |
53.8 |
44.8 |
57.62 |
Mistral |
7B |
2023.12 |
50.8 |
48.2 |
75.4 |
68.7 |
71.0 |
55.6 |
68.4 |
68.1 |
59.5 |
62.97 |
Gemma |
7B |
2024.2 |
47.2 |
49.0 |
76.2 |
69.8 |
70.0 |
59.3 |
66.2 |
79.9 |
60.1 |
64.19 |
BioMistral |
7B |
2024.2 |
50.6 |
48.1 |
77.5 |
59.9 |
64.0 |
56.5 |
60.4 |
59.0 |
54.7 |
58.97 |
Llama 3 |
8B |
2024.4 |
60.9 |
50.7 |
73.0 |
72.1 |
76.0 |
63.0 |
77.2 |
79.9 |
64.2 |
68.56 |
MMed-Llama 3~(我们的) |
8B |
- |
65.4 |
63.5 |
80.1 |
71.3 |
85.0 |
69.6 |
77.6 |
74.3 |
66.5 |
72.59 |
📄 许可证
本项目使用 llama3 许可证。
📦 模型信息
属性 |
详情 |
模型类型 |
MMed-Llama 3-8B-EnIns |
训练数据 |
Henrychur/MMedC、axiong/pmc_llama_instructions |
支持语言 |
英语、中文、日语、法语、俄语、西班牙语 |
标签 |
医学 |
基础模型 |
Henrychur/MMed-Llama-3-8B |
库名称 |
transformers |
📞 联系我们
如果您有任何问题,请随时联系 qiupengcheng@pjlab.org.cn。
📚 引用
@misc{qiu2024building,
title={Towards Building Multilingual Language Model for Medicine},
author={Pengcheng Qiu and Chaoyi Wu and Xiaoman Zhang and Weixiong Lin and Haicheng Wang and Ya Zhang and Yanfeng Wang and Weidi Xie},
year={2024},
eprint={2402.13963},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
GitHub 仓库 arXiv 论文