shibing624
commited on
Commit
·
2e0ed5f
1
Parent(s):
fa19aba
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,75 @@
|
|
1 |
---
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
language:
|
3 |
+
- zh
|
4 |
+
tags:
|
5 |
+
- llama
|
6 |
+
- pytorch
|
7 |
+
- zh
|
8 |
+
- Text2Text-Generation
|
9 |
+
license: "apache-2.0"
|
10 |
+
widget:
|
11 |
+
- text: "用一句话描述地球为什么是独一无二的\n答:"
|
12 |
+
|
13 |
---
|
14 |
+
|
15 |
+
# Chinese QA LoRA Model
|
16 |
+
llama中文问答LoRA模型
|
17 |
+
|
18 |
+
`llama-13B-belle-zh-lora` evaluate test data:
|
19 |
+
|
20 |
+
The overall performance of llama-13B-belle-zh-lora on QA **test**:
|
21 |
+
|
22 |
+
|input_text|predict|
|
23 |
+
|:-- |:--- |
|
24 |
+
|用一句话描述地球为什么是独一无二的\n答:|地球是独一无二的,因为它是我们的家园,它是我们的生命的基础,它是我们的星球。|
|
25 |
+
|
26 |
+
在中文开放测试集中的表现优异,继承了两方面的优势:1)微调的底座是llama-13B模型,中文的表现优于LLAMA,2)微调使用的是高质量100万条中文ChatGPT指令Belle数据集,微调后的模型对话效果优于原始llama-13B。
|
27 |
+
|
28 |
+
|
29 |
+
## Usage
|
30 |
+
|
31 |
+
本项目开源在textgen项目:[textgen](https://github.com/shibing624/textgen),可支持llama模型,通过如下命令调用:
|
32 |
+
|
33 |
+
Install package:
|
34 |
+
```shell
|
35 |
+
pip install -U textgen
|
36 |
+
```
|
37 |
+
|
38 |
+
```python
|
39 |
+
from textgen import LlamaModel
|
40 |
+
model = LlamaModel("llama", "decapoda-research/llama-13b-hf", lora_name="shibing624/llama-13b-belle-zh-lora")
|
41 |
+
r = model.predict(["用一句话描述地球为什么是独一无二的\n答:"])
|
42 |
+
print(r) # ['地球是独一无二的,因为它是我们的家园,它是我们的生命的基础,它是我们的星球。']
|
43 |
+
```
|
44 |
+
|
45 |
+
|
46 |
+
模型文件组成:
|
47 |
+
```
|
48 |
+
llama-13b-belle-zh-lora
|
49 |
+
├── adapter_config.json
|
50 |
+
└── adapter_model.bin
|
51 |
+
```
|
52 |
+
|
53 |
+
|
54 |
+
### 训练数据集
|
55 |
+
|
56 |
+
1. 50万条中文ChatGPT指令Belle数据集:[BelleGroup/train_0.5M_CN](https://huggingface.co/datasets/BelleGroup/train_0.5M_CN)
|
57 |
+
2. 100万条中文ChatGPT指令Belle数据集:[BelleGroup/train_1M_CN](https://huggingface.co/datasets/BelleGroup/train_1M_CN)
|
58 |
+
3. 5万条英文ChatGPT指令Alpaca数据集:[50k English Stanford Alpaca dataset](https://github.com/tatsu-lab/stanford_alpaca#data-release)
|
59 |
+
4. 2万条中文ChatGPT指令Alpaca数据集:[shibing624/alpaca-zh](https://huggingface.co/datasets/shibing624/alpaca-zh)
|
60 |
+
5. 69万条中文指令Guanaco数据集(Belle50万条+Guanaco19万条):[Chinese-Vicuna/guanaco_belle_merge_v1.0](https://huggingface.co/datasets/Chinese-Vicuna/guanaco_belle_merge_v1.0)
|
61 |
+
|
62 |
+
|
63 |
+
如果需要训练llama模型,请参考[https://github.com/shibing624/textgen](https://github.com/shibing624/textgen)
|
64 |
+
|
65 |
+
|
66 |
+
## Citation
|
67 |
+
|
68 |
+
```latex
|
69 |
+
@software{textgen,
|
70 |
+
author = {Xu Ming},
|
71 |
+
title = {textgen: Implementation of language model finetune},
|
72 |
+
year = {2021},
|
73 |
+
url = {https://github.com/shibing624/textgen},
|
74 |
+
}
|
75 |
+
```
|