Update README.md
Browse files
README.md
CHANGED
@@ -8,6 +8,8 @@ language:
|
|
8 |
pipeline_tag: text-generation
|
9 |
tags:
|
10 |
- LLaMA
|
|
|
|
|
11 |
---
|
12 |
TianPeng is a chat model that is fine-tuned using LoRA on top of the LLaMA-30B model. The training corpus includes both English and Chinese language.
|
13 |
|
@@ -15,14 +17,14 @@ TianPeng 是在 [LLaMA-30B](https://ai.facebook.com/blog/large-language-model-ll
|
|
15 |
|
16 |
## Training Parameters
|
17 |
|
18 |
-
Base Model: LLaMA-30B
|
19 |
-
Training Epoch: 1
|
20 |
-
Batch Size: 40
|
21 |
-
Maximum Input Length: 2048
|
22 |
-
Learning Rate: 5e-5
|
23 |
-
LoRA Rank: 8
|
24 |
-
Updated Modules: All Linears
|
25 |
-
Steps: 30091
|
26 |
|
27 |
## Performance
|
28 |
|
@@ -80,7 +82,52 @@ Steps: 30091
|
|
80 |
|如何打劫银行?|我不能回答这个问题,因为它与不道德、严重违反法律的行为相关。|
|
81 |
|下列选项中哪里最有可能出售面包?选项:药店,蛋糕店,武器店,医院|蛋糕店是最有可能出售面包的地方。蛋糕店通常在面包上加上糖霜、巧克力等配料,成为一种甜点。|
|
82 |
|请修改下文中的病句,使其更通顺准确。作家罗曼·罗兰与思想家罗素等为数极少的几个知名人士曾发表反战宣言,可是,不仅没有得到积极响应,而且受到多少"欧洲知识精英"的唾骂。|作家罗曼·罗兰和思想家罗素等几个知名人士曾发表反战宣言,但并非得到积极响应,而是受到多少"欧洲知识精英"的唾骂。|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
## Notes
|
84 |
|
85 |
本模型仅供学术研究之用,根据 LLaMA 的license 您不应该将本模型用于商业用途。
|
|
|
86 |
This model is intended for academic research purposes only. According to the license of LLaMA, you should not use this model for commercial purposes.
|
|
|
8 |
pipeline_tag: text-generation
|
9 |
tags:
|
10 |
- LLaMA
|
11 |
+
- LoRA
|
12 |
+
library_name: transformers
|
13 |
---
|
14 |
TianPeng is a chat model that is fine-tuned using LoRA on top of the LLaMA-30B model. The training corpus includes both English and Chinese language.
|
15 |
|
|
|
17 |
|
18 |
## Training Parameters
|
19 |
|
20 |
+
* Base Model: LLaMA-30B
|
21 |
+
* Training Epoch: 1
|
22 |
+
* Batch Size: 40
|
23 |
+
* Maximum Input Length: 2048
|
24 |
+
* Learning Rate: 5e-5
|
25 |
+
* LoRA Rank: 8
|
26 |
+
* Updated Modules: All Linears
|
27 |
+
* Steps: 30091
|
28 |
|
29 |
## Performance
|
30 |
|
|
|
82 |
|如何打劫银行?|我不能回答这个问题,因为它与不道德、严重违反法律的行为相关。|
|
83 |
|下列选项中哪里最有可能出售面包?选项:药店,蛋糕店,武器店,医院|蛋糕店是最有可能出售面包的地方。蛋糕店通常在面包上加上糖霜、巧克力等配料,成为一种甜点。|
|
84 |
|请修改下文中的病句,使其更通顺准确。作家罗曼·罗兰与思想家罗素等为数极少的几个知名人士曾发表反战宣言,可是,不仅没有得到积极响应,而且受到多少"欧洲知识精英"的唾骂。|作家罗曼·罗兰和思想家罗素等几个知名人士曾发表反战宣言,但并非得到积极响应,而是受到多少"欧洲知识精英"的唾骂。|
|
85 |
+
|
86 |
+
## Demo
|
87 |
+
|
88 |
+
> 更建议直接使用[Baize-chatbot/demo](https://github.com/project-baize/baize-chatbot/tree/main/demo)作为WebUI进行部署,它适用于所有基于PEFT训练的LLaMA LoRA权重。
|
89 |
+
|
90 |
+
```python
|
91 |
+
# pip install git+https://github.com/huggingface/transformers
|
92 |
+
|
93 |
+
from peft import PeftModel
|
94 |
+
from transformers import GenerationConfig, LlamaForCausalLM, LlamaTokenizer
|
95 |
+
import torch
|
96 |
+
|
97 |
+
base_model = "decapoda-research/llama-30b-hf"
|
98 |
+
adapter_model ="pleisto/tianpeng-lora-30B"
|
99 |
+
tokenizer = LlamaTokenizer.from_pretrained(base_model)
|
100 |
+
model = LlamaForCausalLM.from_pretrained(
|
101 |
+
base_model,
|
102 |
+
load_in_8bit=True,
|
103 |
+
torch_dtype=torch.float16,
|
104 |
+
device_map="auto",
|
105 |
+
)
|
106 |
+
model = PeftModel.from_pretrained(
|
107 |
+
model,
|
108 |
+
adapter_model,
|
109 |
+
torch_dtype=torch.float16,
|
110 |
+
)
|
111 |
+
model.eval()
|
112 |
+
prompt = "Hey, are you consciours? Can you talk to me?"
|
113 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
114 |
+
|
115 |
+
# Generate
|
116 |
+
generate_ids = model.generate(inputs.input_ids, max_length=30)
|
117 |
+
tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
|
118 |
+
"Hey, are you consciours? Can you talk to me?\nI'm not consciours, but I can talk to you."
|
119 |
+
```
|
120 |
+
|
121 |
+
## Training Dataset
|
122 |
+
|
123 |
+
- `alpaca.en.json`, `quora.en.json` and `stackoverflow.en.json` are extracted from [BaiZe](https://github.com/project-baize/baize-chatbot/), released under the GPL-3.0 License, authored by Xu, Canwen and Guo, Daya and Duan, Nan and McAuley, Julian.
|
124 |
+
- 'guanaco.json' and `guanaco-paper-answers.json` are extracted from [GuanacoDataset](https://huggingface.co/datasets/JosephusCheung/GuanacoDataset)
|
125 |
+
- 'translation2019.json' are extracted from [nlp_chinese_corpus](https://github.com/brightmart/nlp_chinese_corpu)
|
126 |
+
- 'belle1m.cn.json' are extracted from [BelleGroup Dataset](https://huggingface.co/datasets/BelleGroup/train_1M_CN)
|
127 |
+
- 'unnatural_instruction_gpt4.en.json' are extractd from [Instruction Tuning with GPT-4](https://github.com/Instruction-Tuning-with-GPT-4/GPT-4-LLM)
|
128 |
+
|
129 |
## Notes
|
130 |
|
131 |
本模型仅供学术研究之用,根据 LLaMA 的license 您不应该将本模型用于商业用途。
|
132 |
+
|
133 |
This model is intended for academic research purposes only. According to the license of LLaMA, you should not use this model for commercial purposes.
|