镜像自地址
https://github.com/SCIR-HI/Huatuo-Llama-Med-Chinese.git
已同步 2025-12-06 06:26:48 +00:00
Update the prompt templates
1. Update README.md 2. Delete useless template json 3. Upload prompt template json for Huozi&Bloom
这个提交包含在:
20
README.md
20
README.md
@@ -110,7 +110,14 @@ infer.sh脚本代码如下,请将下列代码中基模型base_model、lora权
|
|||||||
--lora_weights 'LORA_WEIGHTS_PATH' \
|
--lora_weights 'LORA_WEIGHTS_PATH' \
|
||||||
--use_lora True \
|
--use_lora True \
|
||||||
--instruct_dir 'INFER_DATA_PATH' \
|
--instruct_dir 'INFER_DATA_PATH' \
|
||||||
--prompt_template 'med_template'
|
--prompt_template 'TEMPLATE_PATH'
|
||||||
|
|
||||||
|
|
||||||
|
**_提示模板的选择与模型相关,详情如下:_**
|
||||||
|
|
||||||
|
| 活字&Bloom | LLaMA&Alpaca |
|
||||||
|
|:------------------------------|:--------------------------------------------------------------------------------------|
|
||||||
|
| `templates/bloom_deploy.json` | 基于医学知识库`templates/med_template.json` <br> 基于医学文献`templates/literature_template.json` |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -155,7 +162,7 @@ infer.sh脚本代码如下,请将下列代码中基模型base_model、lora权
|
|||||||
|
|
||||||
指令微调数据集质量仍有限,后续将进行不断迭代,同时医学知识库和数据集构建代码还在整理中,整理完成将会发布。
|
指令微调数据集质量仍有限,后续将进行不断迭代,同时医学知识库和数据集构建代码还在整理中,整理完成将会发布。
|
||||||
|
|
||||||
### 医学文献
|
#### 医学文献
|
||||||
|
|
||||||
此外,我们收集了2023年关于肝癌疾病的中文医学文献,利用GPT3.5接口围绕医学文献的【结论】构建多轮问答数据。在·`./data_literature/liver_cancer.json`中我们提供了其中的1k条训练样例。目前,训练样本的质量仍然有限,在后续我们会进一步迭代数据,会以`公开数据集`的形式对外进行发布。训练样本的示例如下:
|
此外,我们收集了2023年关于肝癌疾病的中文医学文献,利用GPT3.5接口围绕医学文献的【结论】构建多轮问答数据。在·`./data_literature/liver_cancer.json`中我们提供了其中的1k条训练样例。目前,训练样本的质量仍然有限,在后续我们会进一步迭代数据,会以`公开数据集`的形式对外进行发布。训练样本的示例如下:
|
||||||
|
|
||||||
@@ -253,7 +260,7 @@ https://wandb.ai/thinksoso/llama_med/runs/a5wgcnzt/overview?workspace=user-think
|
|||||||
|
|
||||||
本项目参考了以下开源项目,在此对相关项目和研究开发人员表示感谢。
|
本项目参考了以下开源项目,在此对相关项目和研究开发人员表示感谢。
|
||||||
|
|
||||||
|
- 活字: https://github.com/HIT-SCIR/huozi
|
||||||
- Facebook LLaMA: https://github.com/facebookresearch/llama
|
- Facebook LLaMA: https://github.com/facebookresearch/llama
|
||||||
- Stanford Alpaca: https://github.com/tatsu-lab/stanford_alpaca
|
- Stanford Alpaca: https://github.com/tatsu-lab/stanford_alpaca
|
||||||
- alpaca-lora by @tloen: https://github.com/tloen/alpaca-lora
|
- alpaca-lora by @tloen: https://github.com/tloen/alpaca-lora
|
||||||
@@ -269,10 +276,10 @@ https://wandb.ai/thinksoso/llama_med/runs/a5wgcnzt/overview?workspace=user-think
|
|||||||
|
|
||||||
## Citation
|
## Citation
|
||||||
|
|
||||||
如果你使用了本项目的数据或者代码,请声明引用
|
如果您使用了本项目的数据或者代码,请声明引用
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Paper link: [Huatuo: Tuning llama model with chinese medical knowledge](https://arxiv.org/pdf/2304.06975)
|
||||||
```
|
```
|
||||||
|
|
||||||
@misc{wang2023huatuo,
|
@misc{wang2023huatuo,
|
||||||
@@ -283,5 +290,6 @@ https://wandb.ai/thinksoso/llama_med/runs/a5wgcnzt/overview?workspace=user-think
|
|||||||
archivePrefix={arXiv},
|
archivePrefix={arXiv},
|
||||||
primaryClass={cs.CL}
|
primaryClass={cs.CL}
|
||||||
}
|
}
|
||||||
|
[Huatuo: Tuning llama model with chinese medical knowledge](https://arxiv.org/pdf/2304.06975)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
# Prompt templates
|
|
||||||
|
|
||||||
This directory contains template styles for the prompts used to finetune LoRA models.
|
|
||||||
|
|
||||||
## Format
|
|
||||||
|
|
||||||
A template is described via a JSON file with the following keys:
|
|
||||||
|
|
||||||
- `prompt_input`: The template to use when input is not None. Uses `{instruction}` and `{input}` placeholders.
|
|
||||||
- `prompt_no_input`: The template to use when input is None. Uses `{instruction}` placeholders.
|
|
||||||
- `description`: A short description of the template, with possible use cases.
|
|
||||||
- `response_split`: The text to use as separator when cutting real response from the model output.
|
|
||||||
|
|
||||||
No `{response}` placeholder was used, since the response is always the last element of the template and is just to be concatenated to the rest.
|
|
||||||
|
|
||||||
## Example template
|
|
||||||
|
|
||||||
The default template, used unless otherwise specified, is `alpaca.json`
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"description": "Template used by Alpaca-LoRA.",
|
|
||||||
"prompt_input": "Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.\n\n### Instruction:\n{instruction}\n\n### Input:\n{input}\n\n### Response:\n",
|
|
||||||
"prompt_no_input": "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:\n{instruction}\n\n### Response:\n",
|
|
||||||
"response_split": "### Response:"
|
|
||||||
}
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
## Current templates
|
|
||||||
|
|
||||||
### alpaca
|
|
||||||
|
|
||||||
Default template used for generic LoRA fine tunes so far.
|
|
||||||
|
|
||||||
### alpaca_legacy
|
|
||||||
|
|
||||||
Legacy template used by the original alpaca repo, with no `\n` after the response field. Kept for reference and experiments.
|
|
||||||
|
|
||||||
### alpaca_short
|
|
||||||
|
|
||||||
A trimmed down alpaca template which seems to perform just as well and spare some tokens. Models created with the default template seem to be queryable by the short tempalte as well. More experiments are welcome.
|
|
||||||
|
|
||||||
### vigogne
|
|
||||||
|
|
||||||
The default alpaca template, translated to french. This template was used to train the "Vigogne" LoRA and is to be used to query it, or for extra fine tuning.
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"description": "Template used by Alpaca-LoRA.",
|
|
||||||
"prompt_input": "Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.\n\n### Instruction:\n{instruction}\n\n### Input:\n{input}\n\n### Response:\n",
|
|
||||||
"prompt_no_input": "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:\n{instruction}\n\n### Response:\n",
|
|
||||||
"response_split": "### Response:"
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"description": "Legacy template, used by Original Alpaca repository.",
|
|
||||||
"prompt_input": "Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.\n\n### Instruction:\n{instruction}\n\n### Input:\n{input}\n\n### Response:",
|
|
||||||
"prompt_no_input": "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:\n{instruction}\n\n### Response:",
|
|
||||||
"response_split": "### Response:"
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"description": "A shorter template to experiment with.",
|
|
||||||
"prompt_input": "### Instruction:\n{instruction}\n\n### Input:\n{input}\n\n### Response:\n",
|
|
||||||
"prompt_no_input": "### Instruction:\n{instruction}\n\n### Response:\n",
|
|
||||||
"response_split": "### Response:"
|
|
||||||
}
|
|
||||||
8
templates/bloom_deploy.json
普通文件
8
templates/bloom_deploy.json
普通文件
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"description": "Template used by Med Instruction Tuning",
|
||||||
|
"prompt_input": "下面是一个问题,运用医学知识来正确回答提问.\n{instruction}\n\n\n### 回答:\n",
|
||||||
|
"prompt_no_input": "下面是一个问题,运用医学知识来正确回答提问.\n{instruction}\n### 回答:\n",
|
||||||
|
"response_split": "### 回答:"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"description": "Template used by Llama without sft",
|
|
||||||
"prompt_input": "问题:{instruction} 回答:",
|
|
||||||
"prompt_no_input": "问题:{instruction} 回答:",
|
|
||||||
"response_split": "回答:"
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"description": "French template, used by Vigogne for finetuning.",
|
|
||||||
"prompt_input": "Ci-dessous se trouve une instruction qui décrit une tâche, associée à une entrée qui fournit un contexte supplémentaire. Écrivez une réponse qui complète correctement la demande.\n\n### Instruction:\n{instruction}\n\n### Entrée:\n{input}\n\n### Réponse:\n",
|
|
||||||
"prompt_no_input": "Ci-dessous se trouve une instruction qui décrit une tâche. Écrivez une réponse qui complète correctement la demande.\n\n### Instruction:\n{instruction}\n\n### Réponse:\n",
|
|
||||||
"response_split": "### Réponse:"
|
|
||||||
}
|
|
||||||
在新工单中引用
屏蔽一个用户