PengQu commited on
Commit
1451ec7
1 Parent(s): c28329c

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +85 -0
README.md ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ datasets:
4
+ - anon8231489123/ShareGPT_Vicuna_unfiltered
5
+ - PengQu/langchain-MRKL-finetune
6
+ language:
7
+ - zh
8
+ - en
9
+ ---
10
+ # Llama-2-7b-vicuna-Chinese
11
+
12
+ Llama-2-7b-vicuna-Chinese是在中英双语sharegpt数据上全参数微调的对话模型。
13
+
14
+ - 基座模型:[meta-llama/Llama-2-7b-hf](https://huggingface.co/meta-llama/Llama-2-7b-hf) 允许商业使用。
15
+ - 微调数据:ShareGPT,ShareGPT-ZH,Langchain-MRKL-finetune
16
+ - 训练代码:基于[FastChat](https://github.com/lm-sys/FastChat)
17
+
18
+ Llama-2-7b-vicuna-Chinese is a chat model supervised finetuned on vicuna sharegpt data in both **English** and **Chinese**.
19
+
20
+ - Foundation model: [meta-llama/Llama-2-7b-hf](https://huggingface.co/meta-llama/Llama-2-7b-hf), a **commercially available** language model.
21
+ - Finetuning data: ShareGPT,ShareGPT-ZH,Langchain-MRKL-finetune
22
+ - Training code: based on [FastChat](https://github.com/lm-sys/FastChat)
23
+
24
+ ## Loading the Weights with Hugging Face Transformers
25
+ See the following example for usage.
26
+
27
+ ```python
28
+ from transformers import AutoTokenizer, AutoModelForCausalLM
29
+
30
+ tokenizer = AutoTokenizer.from_pretrained("PengQu/Llama-2-7b-vicuna-Chinese",use_fast=False)
31
+ model = AutoModelForCausalLM.from_pretrained("PengQu/Llama-2-7b-vicuna-Chinese").to("cuda")
32
+
33
+ instruction = "A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions. USER: {} ASSISTANT:"
34
+ prompt = instruction.format('用flask写一个简单的http服务器。')
35
+ input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to("cuda")
36
+
37
+ generation_output = model.generate(input_ids=input_ids, max_new_tokens=512)
38
+ print(tokenizer.decode(generation_output[0],skip_special_tokens=True))
39
+ ```
40
+
41
+ 输出如下(output as follows):<br>
42
+ ```
43
+ 要使 用Flask创建一个简单的HTTP服务器,您需要在终端中运行以下命令:
44
+
45
+ pip install Flask
46
+
47
+ 这将安装Flask包并准备您使用它。
48
+ 以下是一个简单的Flask应用程序,它侦听端口5000并响应“Hello, World!”消息:
49
+
50
+ from flask import Flask
51
+ app = Flask(__name__)
52
+ @app.route('/')
53
+ def hello():
54
+ return 'Hello, World!'
55
+ if __name__ == '__main__':
56
+ app.run(debug=True)
57
+
58
+ 要运行此应用程序,您可以将代码保存到名为`app.py`的文件中,然后在终端中运行以下命令:
59
+
60
+ python app.py
61
+
62
+ 这将启动Flask服务器,并且您应该能够通过在Web浏览器中访问`http://localhost:5000`来访问“Hello, World!”消息。
63
+ 您还可以使用Flask的路由功能为不同的URL定义不同的端点。例如,您可以定义一个路由,在端口8080上侦听,并响应“Hello, Flask!”消息:
64
+
65
+ from flask import Flask
66
+ app = Flask(__name__)
67
+ @app.route('/')
68
+ def hello():
69
+ return 'Hello, Flask!'
70
+ if __name__ == '__main__':
71
+ app.run(debug=True, host='localhost', port=8080)
72
+
73
+ 要运行此应用程序,您可以将代码保存到名为`app.py`的文件中,然后在终端中运行以下命令:
74
+
75
+ python app.py
76
+
77
+ ```
78
+ ## Major Improvement:Llama-2-7b-vicuna-Chinese's Chinese and English abilities are better than llama2 and vicuna.
79
+ - 英语能力基础评测(MMLU): Llama-2-7b-vicuna-Chinese(48.8) > Llama-2-7b(45.3) > vicuna1.1(44.8)
80
+ - 中文能力基础评测(C-Eval): Llama-2-7b-vicuna-Chinese(34.7) > Llama-2-7b-chat(30.3)= vicuna1.1(30.3)
81
+ - 实测效果:不会出现Llama2-chat的过于谨慎的状况
82
+ <br>
83
+ - English Eval results(MMLU): Llama-2-7b-vicuna-Chinese(48.8) > Llama-2-7b(45.3) > vicuna1.1(44.8)
84
+ - Chinese Eval results(C-Eval): Llama-2-7b-vicuna-Chinese(34.7) > Llama-2-7b-chat(30.3)= vicuna1.1(30.3)
85
+ - Empirical Results: It will not be overly cautious like Llama2-chat.