Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Repo for BenCao [original name: HuaTuo (华驼)], Instruction-tuning Large Language Models with Chinese Medical Knowledge. 本草(原名:华驼)模型仓库,基于中文医学知识的大语言模型指令微调
| Date | Stars |
|---|---|
| 2026-07-24 | 4980 |
| 2026-07-25 | 4980 |
| 2026-07-28 | 4980 |
| 2026-07-30 | 4980 |
| 2026-07-31 | 4980 |
| 2026-08-06 | 4980 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
[**中文**](./README.md) | [**English**](./README_EN.md)
<p align="center" width="100%">
<a href="https://github.com/SCIR-HI/Huatuo-Llama-Med-Chinese/" target="_blank"><img src="assets/logo/logo_new.png" alt="SCIR-HI-HuaTuo" style="width: 60%; min-width: 300px; display: block; margin: auto;"></a>
</p>
# 本草[原名:华驼(HuaTuo)]: 基于中文医学知识的大语言模型指令微调
### BenTsao (original name: HuaTuo): Instruction-tuning Large Language Models With Chinese Medical Knowledge
[](https://github.com/SCIR-HI/Huatuo-Llama-Med-Chinese/blob/main/LICENSE) [](https://www.python.org/downloads/release/python-390/)
本项目开源了经过中文医学指令精调/指令微调(Instruction-tuning) 的大语言模型集,包括LLaMA、Alpaca-Chinese、Bloom、活字模型等。
我们基于医学知识图谱以及医学文献,结合ChatGPT API构建了中文医学指令微调数据集,并以此对各种基模型进行了指令微调,提高了基模型在医疗领域的问答效果。
## News
**[2024/07/25][《基于知识微调的大语言模型可靠中文医学回复生成方法》](https://dl.acm.org/doi/abs/10.1145/3686807)被ACM TKDD录用**
**[2023/09/24]发布[《面向智慧医疗的大语言模型微调技术》](https://github.com/SCIR-HI/Huatuo-Llama-Med-Chinese/tree/main/doc/Tuning_Methods_for_LLMs_towards_Health_Intelligence.pdf)**
<details>
<summary>历史新闻</summary>
**[2023/09/12]在arxiv发布[《探索大模型从医学文献中交互式知识的获取》](https://arxiv.org/pdf/2309.04198.pdf)**
**[2023/09/08]在arxiv发布[《基于知识微调的大语言模型可靠中文医学回复生成方法》](https://arxiv.org/pdf/2309.04175.pdf)**
**[2023/08/07] 🔥🔥增加了基于[活字](https://github.com/HIT-SCIR/huozi)进行指令微调的模型发布,模型效果显著提升。🔥🔥**
[2023/08/05] 本草模型在CCL 2023 Demo Track进行Poster展示。
[2023/08/03] SCIR实验室开源[活字](https://github.com/HIT-SCIR/huozi)通用问答模型,欢迎大家关注🎉🎉
[2023/07/19] 增加了基于[Bloom](https://huggingface.co/bigscience/bloom-7b1)进行指令微调的模型发布。
[2023/05/12] 模型由"华驼"更名为"本草"。
[2023/04/28] 增加了基于[中文Alpaca大模型](https://github.com/ymcui/Chinese-LLaMA-Alpaca)进行指令微调的模型发布。
[2023/04/24] 增加了基于LLaMA和医学文献进行指令微调的模型发布。
</details>
[2023/03/31] 增加了基于LLaMA和医学知识库进行指令微调的模型发布。
## A Quick Start
首先安装依赖包,python环境建议3.9+
```
pip install -r requirements.txt
```
针对所有基模型,我们采用了半精度基模型LoRA微调的方式进行指令微调训练,以在计算资源与模型性能之间进行权衡。
### 基模型
- [活字1.0](https://github.com/HIT-SCIR/huozi),哈尔滨工业大学基于Bloom-7B二次开发的中文通用问答模型
- [Bloom-7B](https://huggingface.co/bigscience/bloomz-7b1)
- [Alpaca-Chinese-7B](https://github.com/ymcui/Chinese-LLaMA-Alpaca),基于LLaMA二次开发的中文问答模型
- [LLaMA-7B](https://huggingface.co/decapoda-research/llama-7b-hf)
### LoRA模型权重下载
LoRA权重可以通过百度网盘或Hugging Face下载:
1. 🔥对活字进行指令微调的LoRA权重文件
- 基于医学知识库以及医学问答数据集 [百度网盘](https://pan.baidu.com/s/1BPnDNb1wQZTWy_Be6MfcnA?pwd=m21s)
2. 对Bloom进行指令微调的LoRA权重文件
- 基于医学知识库以及医学问答数据集 [百度网盘](https://pan.baidu.com/s/1jPcuEOhesFGYpzJ7U52Fag?pwd=scir)和[Hugging Face](https://huggingface.co/lovepon/lora-bloom-med-bloom)
3. 对Alpaca进行指令微调的LoRA权重文件
- 基于医学知识库 [百度网盘](https://pan.baidu.com/s/16oxcjzXnXjDpL8SKihgNxw?pwd=scir)和[Hugging Face](https://huggingface.co/lovepon/lora-alpaca-med)
- 基于医学知识库和医学文献 [百度网盘](https://pan.baidu.com/s/1HDdK84ASHmzOFlkmypBIJw?pwd=scir)和[Hugging Face](https://huggingface.co/lovepon/lora-alpaca-med-alldata)
4. 对LLaMA进行指令微调的LoRA权重文件
- 基于医学知识库 [百度网盘](https://pan.baidu.com/s/1jih-pEr6jzEa6n2u6sUMOg?pwd=jjpf)和[Hugging Face](https://huggingface.co/thinksoso/lora-llama-med)
- 基于医学文献 [百度网盘](https://pan.baidu.com/s/1jADypClR2bLyXItuFfSjPA?pwd=odsk)和[Hugging Face](https://huggingface.co/lovepon/lora-llama-literature)
下载LoRA权重并解压,解压后的格式如下:
```
**lora-folder-name**/
- adapter_config.json # LoRA权重配置文件
- adapter_model.bin # LoRA权重文件
```
基于相同的数据,我们还训练了医疗版本的ChatGLM模型: [ChatGLM-6B-Med](https://github.com/SCIR-HI/Med-ChatGLM)
### Infer
我们在`./data/infer.json`中提供了一些测试用例,可以替换成其它的数据集,请注意保持格式一致
运行infer脚本
```
#基于医学知识库
bash ./scripts/infer.sh
#基于医学文献
#单轮
bash ./scripts/infer-literature-single.sh
#多轮
bash ./scripts/infer-literature-multi.sh
```
infer.sh脚本代码如下,请将下列代码中基模型base_model、lora权重lora_weights以及测试数据集路径instruct_dir进行替换后运行
python infer.py \
--base_model 'BASE_MODEL_PATH' \
--lora_weights 'LORA_WEIGHTS_PATH' \
--use_lora True \
--instrucExcerpt of 12,291 characters
Read on GitHubWould you bet a product on this? Bounded 0–100 and slow moving.
matched fp:bb755686c2d2a872, topic:llm, topic:llama
matched fp:bb755686c2d2a872, topic:nlp
matched fp:bb755686c2d2a872, topic:medical