BAAI
/

shunxing1234 commited on
Commit
efe15f8
1 Parent(s): 4488412

Create README_zh.md

Browse files
Files changed (1) hide show
  1. README_zh.md +59 -0
README_zh.md ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ ---
4
+
5
+
6
+ ![Aquila_logo](./log.jpeg)
7
+
8
+
9
+ <h4 align="center">
10
+ <p>
11
+ <a href="https://huggingface.co/BAAI/AquilaChat2-34B/blob/main/README.md">English</a>
12
+ <b>简体中文</b> |
13
+ </p>
14
+ </h4>
15
+
16
+ # 悟道·天鹰(Aquila2)
17
+
18
+ 我们开源了我们的 **Aquila2** 系列,现在包括基础语言模型 **Aquila2-7B** 和 **Aquila2-34B** ,对话模型 **AquilaChat2-7B** 和 **AquilaChat2-34B**,长文本对话模型**AquilaChat2-7B-16k** 和 **AquilaChat2-34B-16k**
19
+
20
+ 悟道 · 天鹰 Aquila 模型的更多细节将在官方技术报告中呈现。请关注官方渠道更新。
21
+
22
+ ## 对话模型性能
23
+
24
+ <br>
25
+ <p align="center">
26
+ <img src="chat_metrics.jpeg" width="1024"/>
27
+ <p>
28
+ <br>
29
+
30
+ ## 快速开始使用 AquilaChat2-34B
31
+
32
+
33
+ ## 使用方式/How to use
34
+
35
+ ### 1. 推理/Inference
36
+
37
+ ```python
38
+ from transformers import AutoTokenizer, AutoModelForCausalLM
39
+ import torch
40
+ device = torch.device("cuda")
41
+ model_info = "BAAI/AquilaChat2-34B"
42
+ tokenizer = AutoTokenizer.from_pretrained(model_info, trust_remote_code=True)
43
+ model = AutoModelForCausalLM.from_pretrained(model_info, trust_remote_code=True)
44
+ model.eval()
45
+ model.to(device)
46
+ text = "请给出10个要到北京旅游的理由。"
47
+ tokens = tokenizer.encode_plus(text)['input_ids']
48
+ tokens = torch.tensor(tokens)[None,].to(device)
49
+ stop_tokens = ["###", "[UNK]", "</s>"]
50
+ with torch.no_grad():
51
+ out = model.generate(tokens, do_sample=True, max_length=512, eos_token_id=100007, bad_words_ids=[[tokenizer.encode(token)[0] for token in stop_tokens]])[0]
52
+ out = tokenizer.decode(out.cpu().numpy().tolist())
53
+ print(out)
54
+ ```
55
+
56
+
57
+ ## 证书/License
58
+
59
+ Aquila2系列开源模型使用 [智源Aquila系列模型许可协议](https://huggingface.co/BAAI/AquilaChat2-7B/blob/main/BAAI-Aquila-Model-License%20-Agreement.pdf)