hiyouga commited on
Commit
71b3c36
·
verified ·
1 Parent(s): b642c46

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +60 -49
README.md CHANGED
@@ -1,50 +1,55 @@
1
  ---
2
- license: other
3
- license_name: llama3
4
- license_link: LICENSE
5
  library_name: transformers
 
6
  base_model: meta-llama/Meta-Llama-3-8B-Instruct
7
  language:
8
  - en
9
  - zh
10
- pipeline_tag: text-generation
11
  tags:
12
  - llama-factory
13
  - orpo
14
  ---
15
 
16
- This model is developed by [Shenzhi Wang](https://shenzhi-wang.netlify.app) (王慎执) and [Yaowei Zheng](https://github.com/hiyouga) (郑耀威).
17
-
18
  🌟 We included all instructions on how to download, use, and reproduce our various kinds of models at [this GitHub repo](https://github.com/Shenzhi-Wang/Llama3-Chinese-Chat). If you like our models, we would greatly appreciate it if you could star our Github repository. Additionally, please click "like" on our HuggingFace repositories. Thank you!
19
 
 
20
 
21
- # Updates:
22
  - 🔥 We provide an online interactive demo for Llama3-8B-Chinese-Chat-v2 [here](https://huggingface.co/spaces/llamafactory/Llama3-8B-Chinese-Chat). Have fun with our latest model!
23
- - 🚀🚀🚀 [Apr. 29, 2024] We now introduce Llama3-8B-Chinese-Chat-**v2**! Compared to v1, the training dataset of v2 is **5 times larger** (~100K preference pairs), and it exhibits significant enhancements, especially in **roleplay**, **function calling**, and **math** capabilities! The training dataset of Llama3-8B-Chinese-Chat-v2 will be released soon. If you love our Llama3-8B-Chinese-Chat-v1, you won't want to miss out on Llama3-8B-Chinese-Chat-v2!
24
 
25
  The following are updates for [Llama3-8B-Chinese-Chat-v1](https://huggingface.co/shenzhi-wang/Llama3-8B-Chinese-Chat/tree/v1):
 
26
  - 🔥 We provide the official Ollama model for the FP16 GGUF version of Llama3-8B-Chinese-Chat at [wangshenzhi/llama3-8b-chinese-chat-ollama-fp16](https://ollama.com/wangshenzhi/llama3-8b-chinese-chat-ollama-fp16)! Run the following command for quick use of this model: `ollama run wangshenzhi/llama3-8b-chinese-chat-ollama-fp16`.
27
  - 🔥 We provide the official Ollama model for the 8bit-quantized GGUF version of Llama3-8B-Chinese-Chat at [wangshenzhi/llama3-8b-chinese-chat-ollama-q8](https://ollama.com/wangshenzhi/llama3-8b-chinese-chat-ollama-q8)! Run the following command for quick use of this model: `ollama run wangshenzhi/llama3-8b-chinese-chat-ollama-q8`.
28
  - 🔥 We provide the official FP16 GGUF version of Llama3-8B-Chinese-Chat at [shenzhi-wang/Llama3-8B-Chinese-Chat-GGUF-fp16](https://huggingface.co/shenzhi-wang/Llama3-8B-Chinese-Chat-GGUF-fp16)!
29
  - 🔥 We provide the official 8bit-quantized GGUF version of Llama3-8B-Chinese-Chat at [shenzhi-wang/Llama3-8B-Chinese-Chat-GGUF-8bit](https://huggingface.co/shenzhi-wang/Llama3-8B-Chinese-Chat-GGUF-8bit)!
30
  - 🌟 If you are in China, you can download our model from our [Gitee AI repository](https://ai.gitee.com/hf-models/shenzhi-wang/Llama3-8B-Chinese-Chat).
31
 
32
- # 1. Introduction
33
 
34
- ❗️❗️❗️NOTICE: The main branch contains the files for Llama3-8B-Chinese-Chat-**v2**, if you want to use our Llama3-8B-Chinese-Chat-**v1**, please refer to [the `v1` branch](https://huggingface.co/shenzhi-wang/Llama3-8B-Chinese-Chat/tree/v1).
35
 
 
36
 
37
- This is the first Chinese chat model specifically fine-tuned for Chinese through ORPO [1] based on the [Meta-Llama-3-8B-Instruct model](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct).
 
 
 
 
 
38
 
39
- **Compared to the original [Meta-Llama-3-8B-Instruct model](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct), our Llama3-8B-Chinese-Chat-v1 model significantly reduces the issues of "Chinese questions with English answers" and the mixing of Chinese and English in responses. Additionally, compared to the original model, our model greatly reduces the number of emojis in the answers, making the responses more formal.**
40
 
41
- **Compared to [Llama3-8B-Chinese-Chat-v1](https://huggingface.co/shenzhi-wang/Llama3-8B-Chinese-Chat/tree/v1), our Llama3-8B-Chinese-Chat-v2 model significantly increases the training data size (from 20K to 100K), which introduces great performance enhancement, especially in roleplay, function calling, and math.**
42
 
43
- [1] Hong, Jiwoo, Noah Lee, and James Thorne. "Reference-free Monolithic Preference Optimization with Odds Ratio." arXiv preprint arXiv:2403.07691 (2024).
44
 
 
45
 
46
- Training framework: [LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory/tree/main) (commit id: 32347901d4af94ccd72b3c7e1afaaceb5cb3d26a).
47
 
 
48
 
49
  Training details:
50
  - epochs: 3
@@ -57,6 +62,8 @@ Training details:
57
  - fine-tuning type: full parameters
58
  - optimizer: paged_adamw_32bit
59
 
 
 
60
 
61
  To reproduce Llama3-8B-Chinese-Chat-**v2** (to reproduce Llama3-8B-Chinese-Chat-**v1**, please refer to [this link](https://huggingface.co/shenzhi-wang/Llama3-8B-Chinese-Chat/blob/v1/README.md#1-introduction)):
62
 
@@ -99,6 +106,8 @@ deepspeed --num_gpus 8 src/train_bash.py \
99
  --optim paged_adamw_32bit
100
  ```
101
 
 
 
102
  # 2. Usage
103
 
104
  ```python
@@ -112,7 +121,6 @@ model = AutoModelForCausalLM.from_pretrained(
112
  )
113
 
114
  messages = [
115
- {"role": "system", "content": "You are Llama3-8B-Chinese-Chat-v2, which is finetuned on Llama3-8B-Instruct with Chinese-English mixed data by the ORPO alignment algorithm. You are a helpful assistant."},
116
  {"role": "user", "content": "介绍一下你自己"},
117
  ]
118
 
@@ -122,7 +130,7 @@ input_ids = tokenizer.apply_chat_template(
122
 
123
  outputs = model.generate(
124
  input_ids,
125
- max_new_tokens=8196,
126
  do_sample=True,
127
  temperature=0.6,
128
  top_p=0.9,
@@ -134,6 +142,7 @@ print(tokenizer.decode(response, skip_special_tokens=True))
134
  # 3. Examples
135
 
136
  The following are some examples generated by Llama3-8B-Chinese-Chat-**v2**, including examples of roleplay, function calling, math, RuoZhiBa (弱智吧), safety, writing, and coding, etc.
 
137
  For the examples generated by Llama3-8B-Chinese-Chat-**v1**, please refer to [this link](https://huggingface.co/shenzhi-wang/Llama3-8B-Chinese-Chat/blob/v1/README.md#3-examples).
138
 
139
  ---
@@ -172,8 +181,6 @@ To my dear fans, I'd sing a song of gratitude, for the love and light you bring
172
 
173
  ---
174
 
175
-
176
-
177
  **User:**
178
 
179
  ```
@@ -386,13 +393,12 @@ def directly_answer():
386
  pass
387
  ```
388
 
389
- Write 'Action:' followed by a JSON in the following format. e.g.
390
  Action:
391
-
392
  ```json
393
  [
394
  {
395
- "tool_name": "title of the tool in the specification",
396
  "parameters": "the input to the tool"
397
  }
398
  ]
@@ -404,7 +410,6 @@ What's the biggest penguin in the world?
404
  **Assistant:**
405
 
406
  Action:
407
-
408
  ```json
409
  [
410
  {
@@ -421,45 +426,51 @@ Action:
421
  **User:**
422
 
423
  ````
424
- 用中文给刘总发个邮件,需要遵循标准邮件的格式,告诉他我们对于进货价的要求是不能超过100元每件。
425
 
 
426
  ```json
427
- [{
428
- "name": "send_email",
429
- "description": "send email assistant",
430
- "parameters": {
431
- "type": "object",
432
- "properties": {
433
- "receiver": {
434
- "type": "string",
435
- "description": "email receiver"
436
- },
437
- "content": {
438
- "type": "string",
439
- "description": "email content"
440
- }
441
- },
442
- "required": ["receiver", "content"]
443
- }
444
- }]
445
- ```
446
-
447
- 请按以下格式写出以“Action:”开头的 JSON。例如:
448
- Action:
 
449
 
 
 
450
  ```json
451
  [
452
  {
453
- "tool_name": "title of the tool in the specification",
454
  "parameters": "the input to the tool"
455
  }
456
  ]
457
  ```
 
 
 
458
  ````
459
 
460
  **Assistant:**
461
- Action:
462
 
 
463
  ```json
464
  [
465
  {
@@ -966,4 +977,4 @@ int main() {
966
 
967
  在`main`函数中,我们提供了一个例子,搜索文本`"ABC ABCDAB ABCDABCDABDE"`中的模式`"ABCDABD"`。如果找到匹配,输出将是`"Pattern found at index"`,随后是匹配的起始索引。如果没有找到匹配,输出将是`"Pattern not found"`。
968
 
969
- 请注意,这段代码假设输入文本和模式字符串只包含小写英文字母和中文字符。如果需要处理其他字符集,可能需要适当调整。
 
1
  ---
2
+ license: llama3
 
 
3
  library_name: transformers
4
+ pipeline_tag: text-generation
5
  base_model: meta-llama/Meta-Llama-3-8B-Instruct
6
  language:
7
  - en
8
  - zh
 
9
  tags:
10
  - llama-factory
11
  - orpo
12
  ---
13
 
 
 
14
  🌟 We included all instructions on how to download, use, and reproduce our various kinds of models at [this GitHub repo](https://github.com/Shenzhi-Wang/Llama3-Chinese-Chat). If you like our models, we would greatly appreciate it if you could star our Github repository. Additionally, please click "like" on our HuggingFace repositories. Thank you!
15
 
16
+ # Updates
17
 
 
18
  - 🔥 We provide an online interactive demo for Llama3-8B-Chinese-Chat-v2 [here](https://huggingface.co/spaces/llamafactory/Llama3-8B-Chinese-Chat). Have fun with our latest model!
19
+ - 🚀🚀🚀 [Apr. 29, 2024] We now introduce Llama3-8B-Chinese-Chat-**v2**! Compared to v1, the training dataset of v2 is **5x larger** (~100K preference pairs), and it exhibits significant enhancements, especially in **roleplay**, **function calling**, and **math** capabilities! The training dataset of Llama3-8B-Chinese-Chat-v2 will be released soon. If you love our Llama3-8B-Chinese-Chat-v1, you won't want to miss out on Llama3-8B-Chinese-Chat-v2!
20
 
21
  The following are updates for [Llama3-8B-Chinese-Chat-v1](https://huggingface.co/shenzhi-wang/Llama3-8B-Chinese-Chat/tree/v1):
22
+
23
  - 🔥 We provide the official Ollama model for the FP16 GGUF version of Llama3-8B-Chinese-Chat at [wangshenzhi/llama3-8b-chinese-chat-ollama-fp16](https://ollama.com/wangshenzhi/llama3-8b-chinese-chat-ollama-fp16)! Run the following command for quick use of this model: `ollama run wangshenzhi/llama3-8b-chinese-chat-ollama-fp16`.
24
  - 🔥 We provide the official Ollama model for the 8bit-quantized GGUF version of Llama3-8B-Chinese-Chat at [wangshenzhi/llama3-8b-chinese-chat-ollama-q8](https://ollama.com/wangshenzhi/llama3-8b-chinese-chat-ollama-q8)! Run the following command for quick use of this model: `ollama run wangshenzhi/llama3-8b-chinese-chat-ollama-q8`.
25
  - 🔥 We provide the official FP16 GGUF version of Llama3-8B-Chinese-Chat at [shenzhi-wang/Llama3-8B-Chinese-Chat-GGUF-fp16](https://huggingface.co/shenzhi-wang/Llama3-8B-Chinese-Chat-GGUF-fp16)!
26
  - 🔥 We provide the official 8bit-quantized GGUF version of Llama3-8B-Chinese-Chat at [shenzhi-wang/Llama3-8B-Chinese-Chat-GGUF-8bit](https://huggingface.co/shenzhi-wang/Llama3-8B-Chinese-Chat-GGUF-8bit)!
27
  - 🌟 If you are in China, you can download our model from our [Gitee AI repository](https://ai.gitee.com/hf-models/shenzhi-wang/Llama3-8B-Chinese-Chat).
28
 
29
+ # Model Summary
30
 
31
+ Llama3-8B-Chinese-Chat is an instruction-tuned language model for Chinese & English users with various abilities such as roleplaying & tool-using built upon the Meta-Llama-3-8B-Instruct model.
32
 
33
+ Developed by: [Shenzhi Wang](https://shenzhi-wang.netlify.app) (王慎执) and [Yaowei Zheng](https://github.com/hiyouga) (郑耀威)
34
 
35
+ - License: [Llama-3 License](https://llama.meta.com/llama3/license/)
36
+ - Base Model: Meta-Llama-3-8B-Instruct
37
+ - Model Size: 8.02B
38
+ - Context length: 8K
39
+
40
+ # 1. Introduction
41
 
42
+ ❗️❗️❗️NOTICE: The main branch contains the files for Llama3-8B-Chinese-Chat-**v2**, if you want to use our Llama3-8B-Chinese-Chat-**v1**, please refer to [the `v1` branch](https://huggingface.co/shenzhi-wang/Llama3-8B-Chinese-Chat/tree/v1).
43
 
44
+ This is the first model specifically fine-tuned for Chinese & English user through ORPO [1] based on the [Meta-Llama-3-8B-Instruct model](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct).
45
 
46
+ **Compared to the original [Meta-Llama-3-8B-Instruct model](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct), our Llama3-8B-Chinese-Chat-v1 model significantly reduces the issues of "Chinese questions with English answers" and the mixing of Chinese and English in responses.**
47
 
48
+ **Compared to [Llama3-8B-Chinese-Chat-v1](https://huggingface.co/shenzhi-wang/Llama3-8B-Chinese-Chat/tree/v1), our Llama3-8B-Chinese-Chat-v2 model significantly increases the training data size (from 20K to 100K), which introduces great performance enhancement, especially in roleplay, tool using, and math.**
49
 
50
+ [1] Hong, Jiwoo, Noah Lee, and James Thorne. "Reference-free Monolithic Preference Optimization with Odds Ratio." arXiv preprint arXiv:2403.07691 (2024).
51
 
52
+ Training framework: [LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory).
53
 
54
  Training details:
55
  - epochs: 3
 
62
  - fine-tuning type: full parameters
63
  - optimizer: paged_adamw_32bit
64
 
65
+ <details>
66
+ <summary>To reproduce the model</summary>
67
 
68
  To reproduce Llama3-8B-Chinese-Chat-**v2** (to reproduce Llama3-8B-Chinese-Chat-**v1**, please refer to [this link](https://huggingface.co/shenzhi-wang/Llama3-8B-Chinese-Chat/blob/v1/README.md#1-introduction)):
69
 
 
106
  --optim paged_adamw_32bit
107
  ```
108
 
109
+ </details>
110
+
111
  # 2. Usage
112
 
113
  ```python
 
121
  )
122
 
123
  messages = [
 
124
  {"role": "user", "content": "介绍一下你自己"},
125
  ]
126
 
 
130
 
131
  outputs = model.generate(
132
  input_ids,
133
+ max_new_tokens=8192,
134
  do_sample=True,
135
  temperature=0.6,
136
  top_p=0.9,
 
142
  # 3. Examples
143
 
144
  The following are some examples generated by Llama3-8B-Chinese-Chat-**v2**, including examples of roleplay, function calling, math, RuoZhiBa (弱智吧), safety, writing, and coding, etc.
145
+
146
  For the examples generated by Llama3-8B-Chinese-Chat-**v1**, please refer to [this link](https://huggingface.co/shenzhi-wang/Llama3-8B-Chinese-Chat/blob/v1/README.md#3-examples).
147
 
148
  ---
 
181
 
182
  ---
183
 
 
 
184
  **User:**
185
 
186
  ```
 
393
  pass
394
  ```
395
 
396
+ Write 'Action:' followed by a list of actions in JSON that you want to call, e.g.
397
  Action:
 
398
  ```json
399
  [
400
  {
401
+ "tool_name": "tool name (one of [internet_search, directly_answer])",
402
  "parameters": "the input to the tool"
403
  }
404
  ]
 
410
  **Assistant:**
411
 
412
  Action:
 
413
  ```json
414
  [
415
  {
 
426
  **User:**
427
 
428
  ````
 
429
 
430
+ You have access to the following tools:
431
  ```json
432
+ [
433
+ {
434
+ "name": "send_email",
435
+ "description": "send email assistant",
436
+ "parameters": {
437
+ "type": "object",
438
+ "properties": {
439
+ "receiver": {
440
+ "type": "string",
441
+ "description": "email receiver"
442
+ },
443
+ "content": {
444
+ "type": "string",
445
+ "description": "email content"
446
+ }
447
+ },
448
+ "required": [
449
+ "receiver", "content"
450
+ ]
451
+ }
452
+ }
453
+ ]
454
+ ```
455
 
456
+ Write 'Action:' followed by a list of actions in JSON that you want to call, e.g.
457
+ Action:
458
  ```json
459
  [
460
  {
461
+ "tool_name": "tool name (one of [internet_search, directly_answer])",
462
  "parameters": "the input to the tool"
463
  }
464
  ]
465
  ```
466
+
467
+ 用中文给刘总发个邮件,需要遵循标准邮件的格式,告诉他我们对于进货价的要求是不能超过100元每件。
468
+
469
  ````
470
 
471
  **Assistant:**
 
472
 
473
+ Action:
474
  ```json
475
  [
476
  {
 
977
 
978
  在`main`函数中,我们提供了一个例子,搜索文本`"ABC ABCDAB ABCDABCDABDE"`中的模式`"ABCDABD"`。如果找到匹配,输出将是`"Pattern found at index"`,随后是匹配的起始索引。如果没有找到匹配,输出将是`"Pattern not found"`。
979
 
980
+ 请注意,这段代码假设输入文本和模式字符串只包含小写英文字母和中文字符。如果需要处理其他字符集,可能需要适当调整。