model
#4
by
bzxlZhou
- opened
- README.md +3 -31
- added_tokens.json +3 -0
- modeling_baichuan.py +0 -1
- tokenization_baichuan.py +5 -7
README.md
CHANGED
@@ -2,8 +2,7 @@
|
|
2 |
language:
|
3 |
- en
|
4 |
- zh
|
5 |
-
|
6 |
-
license_link: https://huggingface.co/baichuan-inc/Baichuan2-7B-Chat/blob/main/Community%20License%20for%20Baichuan2%20Model.pdf
|
7 |
tasks:
|
8 |
- text-generation
|
9 |
---
|
@@ -20,7 +19,6 @@ tasks:
|
|
20 |
<a href="https://github.com/baichuan-inc/Baichuan2" target="_blank">🦉GitHub</a> | <a href="https://github.com/baichuan-inc/Baichuan-7B/blob/main/media/wechat.jpeg?raw=true" target="_blank">💬WeChat</a>
|
21 |
</div>
|
22 |
<div align="center">
|
23 |
-
百川API支持搜索增强和192K长窗口,新增百川搜索增强知识库、限时免费!<br>
|
24 |
🚀 <a href="https://www.baichuan-ai.com/" target="_blank">百川大模型在线对话平台</a> 已正式向公众开放 🎉
|
25 |
</div>
|
26 |
|
@@ -29,7 +27,6 @@ tasks:
|
|
29 |
- [📖 模型介绍/Introduction](#Introduction)
|
30 |
- [⚙️ 快速开始/Quick Start](#Start)
|
31 |
- [📊 Benchmark评估/Benchmark Evaluation](#Benchmark)
|
32 |
-
- [👥 社区与生态/Community](#Community)
|
33 |
- [📜 声明与协议/Terms and Conditions](#Terms)
|
34 |
|
35 |
|
@@ -118,16 +115,6 @@ In addition to the [Baichuan2-7B-Base](https://huggingface.co/baichuan-inc/Baich
|
|
118 |
|
119 |
![checkpoint](https://huggingface.co/baichuan-inc/Baichuan2-7B-Base/resolve/main/checkpoints.jpeg)
|
120 |
|
121 |
-
# <span id="Community">社区与生态/Community</span>
|
122 |
-
|
123 |
-
## Intel 酷睿 Ultra 平台运行百川大模型
|
124 |
-
|
125 |
-
使用酷睿™/至强® 可扩展处理器或配合锐炫™ GPU等进行部署[Baichuan2-7B-Chat],[Baichuan2-13B-Chat]模型,推荐使用 BigDL-LLM([CPU], [GPU])以发挥更好推理性能。
|
126 |
-
|
127 |
-
详细支持信息可参考[中文操作手册](https://github.com/intel-analytics/bigdl-llm-tutorial/tree/main/Chinese_Version),包括用notebook支持,[加载,优化,保存方法](https://github.com/intel-analytics/bigdl-llm-tutorial/blob/main/Chinese_Version/ch_3_AppDev_Basic/3_BasicApp.ipynb)等。
|
128 |
-
|
129 |
-
When deploy on Core™/Xeon® Scalable Processors or with Arc™ GPU, BigDL-LLM ([CPU], [GPU]) is recommended to take full advantage of better inference performance.
|
130 |
-
|
131 |
# <span id="Terms">声明与协议/Terms and Conditions</span>
|
132 |
|
133 |
## 声明
|
@@ -145,21 +132,9 @@ We have done our best to ensure the compliance of the data used in the model tra
|
|
145 |
|
146 |
## 协议
|
147 |
|
148 |
-
|
149 |
-
1. 您或您的关联方的服务或产品的日均用户活跃量(DAU)低于100万。
|
150 |
-
2. 您或您的关联方不是软件服务提供商、云服务提供商。
|
151 |
-
3. 您或您的关联方不存在将授予您的商用许可,未经百川许可二次授权给其他第三方的可能。
|
152 |
-
|
153 |
-
在符合以上条件的前提下,您需要通过以下联系邮箱 [email protected] ,提交《Baichuan 2 模型社区许可协议》要求的申请材料。审核通过后,百川将特此授予您一个非排他性、全球性、不可转让、不可再许可、可撤销的商用版权许可。
|
154 |
-
|
155 |
-
The community usage of Baichuan 2 model requires adherence to [Apache 2.0](https://github.com/baichuan-inc/Baichuan2/blob/main/LICENSE) and [Community License for Baichuan2 Model](https://huggingface.co/baichuan-inc/Baichuan2-7B-Base/resolve/main/Baichuan%202%E6%A8%A1%E5%9E%8B%E7%A4%BE%E5%8C%BA%E8%AE%B8%E5%8F%AF%E5%8D%8F%E8%AE%AE.pdf). The Baichuan 2 model supports commercial use. If you plan to use the Baichuan 2 model or its derivatives for commercial purposes, please ensure that your entity meets the following conditions:
|
156 |
-
|
157 |
-
1. The Daily Active Users (DAU) of your or your affiliate's service or product is less than 1 million.
|
158 |
-
2. Neither you nor your affiliates are software service providers or cloud service providers.
|
159 |
-
3. There is no possibility for you or your affiliates to grant the commercial license given to you, to reauthorize it to other third parties without Baichuan's permission.
|
160 |
-
|
161 |
-
Upon meeting the above conditions, you need to submit the application materials required by the Baichuan 2 Model Community License Agreement via the following contact email: [email protected]. Once approved, Baichuan will hereby grant you a non-exclusive, global, non-transferable, non-sublicensable, revocable commercial copyright license.
|
162 |
|
|
|
163 |
|
164 |
[GitHub]:https://github.com/baichuan-inc/Baichuan2
|
165 |
[Baichuan2]:https://github.com/baichuan-inc/Baichuan2
|
@@ -187,6 +162,3 @@ Upon meeting the above conditions, you need to submit the application materials
|
|
187 |
[[email protected]]: mailto:[email protected]
|
188 |
[训练过程heckpoint下载]: https://huggingface.co/baichuan-inc/Baichuan2-7B-Intermediate-Checkpoints
|
189 |
[百川智能]: https://www.baichuan-ai.com
|
190 |
-
|
191 |
-
[CPU]: https://github.com/intel-analytics/BigDL/tree/main/python/llm/example/CPU/HF-Transformers-AutoModels/Model/baichuan2
|
192 |
-
[GPU]: https://github.com/intel-analytics/BigDL/tree/main/python/llm/example/GPU/HF-Transformers-AutoModels/Model/baichuan2
|
|
|
2 |
language:
|
3 |
- en
|
4 |
- zh
|
5 |
+
license: other
|
|
|
6 |
tasks:
|
7 |
- text-generation
|
8 |
---
|
|
|
19 |
<a href="https://github.com/baichuan-inc/Baichuan2" target="_blank">🦉GitHub</a> | <a href="https://github.com/baichuan-inc/Baichuan-7B/blob/main/media/wechat.jpeg?raw=true" target="_blank">💬WeChat</a>
|
20 |
</div>
|
21 |
<div align="center">
|
|
|
22 |
🚀 <a href="https://www.baichuan-ai.com/" target="_blank">百川大模型在线对话平台</a> 已正式向公众开放 🎉
|
23 |
</div>
|
24 |
|
|
|
27 |
- [📖 模型介绍/Introduction](#Introduction)
|
28 |
- [⚙️ 快速开始/Quick Start](#Start)
|
29 |
- [📊 Benchmark评估/Benchmark Evaluation](#Benchmark)
|
|
|
30 |
- [📜 声明与协议/Terms and Conditions](#Terms)
|
31 |
|
32 |
|
|
|
115 |
|
116 |
![checkpoint](https://huggingface.co/baichuan-inc/Baichuan2-7B-Base/resolve/main/checkpoints.jpeg)
|
117 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
# <span id="Terms">声明与协议/Terms and Conditions</span>
|
119 |
|
120 |
## 声明
|
|
|
132 |
|
133 |
## 协议
|
134 |
|
135 |
+
Baichuan 2 模型的社区使用需遵循[《Baichuan 2 模型社区许可协议》]。Baichuan 2 支持商用。如果将 Baichuan 2 模型或其衍生品用作商业用途,请您按照如下方式联系许可方,以进行登记并向许可方申请书面授权:联系邮箱 [[email protected]]。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
|
137 |
+
The use of the source code in this repository follows the open-source license Apache 2.0. Community use of the Baichuan 2 model must adhere to the [Community License for Baichuan 2 Model](https://huggingface.co/baichuan-inc/Baichuan2-7B-Base/blob/main/Baichuan%202%E6%A8%A1%E5%9E%8B%E7%A4%BE%E5%8C%BA%E8%AE%B8%E5%8F%AF%E5%8D%8F%E8%AE%AE.pdf). Baichuan 2 supports commercial use. If you are using the Baichuan 2 models or their derivatives for commercial purposes, please contact the licensor in the following manner for registration and to apply for written authorization: Email [email protected].
|
138 |
|
139 |
[GitHub]:https://github.com/baichuan-inc/Baichuan2
|
140 |
[Baichuan2]:https://github.com/baichuan-inc/Baichuan2
|
|
|
162 |
[[email protected]]: mailto:[email protected]
|
163 |
[训练过程heckpoint下载]: https://huggingface.co/baichuan-inc/Baichuan2-7B-Intermediate-Checkpoints
|
164 |
[百川智能]: https://www.baichuan-ai.com
|
|
|
|
|
|
added_tokens.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"<pad>": 125696
|
3 |
+
}
|
modeling_baichuan.py
CHANGED
@@ -502,7 +502,6 @@ class NormHead(nn.Module):
|
|
502 |
def forward(self, hidden_states):
|
503 |
if self.training:
|
504 |
norm_weight = nn.functional.normalize(self.weight)
|
505 |
-
self.first_flag = True
|
506 |
elif self.first_flag:
|
507 |
self.first_flag = False
|
508 |
self.weight.data = nn.functional.normalize(self.weight)
|
|
|
502 |
def forward(self, hidden_states):
|
503 |
if self.training:
|
504 |
norm_weight = nn.functional.normalize(self.weight)
|
|
|
505 |
elif self.first_flag:
|
506 |
self.first_flag = False
|
507 |
self.weight.data = nn.functional.normalize(self.weight)
|
tokenization_baichuan.py
CHANGED
@@ -72,13 +72,6 @@ class BaichuanTokenizer(PreTrainedTokenizer):
|
|
72 |
eos_token = AddedToken(eos_token, lstrip=False, rstrip=False) if isinstance(eos_token, str) else eos_token
|
73 |
unk_token = AddedToken(unk_token, lstrip=False, rstrip=False) if isinstance(unk_token, str) else unk_token
|
74 |
pad_token = AddedToken(pad_token, lstrip=False, rstrip=False) if isinstance(pad_token, str) else pad_token
|
75 |
-
|
76 |
-
self.vocab_file = vocab_file
|
77 |
-
self.add_bos_token = add_bos_token
|
78 |
-
self.add_eos_token = add_eos_token
|
79 |
-
self.sp_model = spm.SentencePieceProcessor(**self.sp_model_kwargs)
|
80 |
-
self.sp_model.Load(vocab_file)
|
81 |
-
|
82 |
super().__init__(
|
83 |
bos_token=bos_token,
|
84 |
eos_token=eos_token,
|
@@ -90,6 +83,11 @@ class BaichuanTokenizer(PreTrainedTokenizer):
|
|
90 |
clean_up_tokenization_spaces=clean_up_tokenization_spaces,
|
91 |
**kwargs,
|
92 |
)
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
def __getstate__(self):
|
95 |
state = self.__dict__.copy()
|
|
|
72 |
eos_token = AddedToken(eos_token, lstrip=False, rstrip=False) if isinstance(eos_token, str) else eos_token
|
73 |
unk_token = AddedToken(unk_token, lstrip=False, rstrip=False) if isinstance(unk_token, str) else unk_token
|
74 |
pad_token = AddedToken(pad_token, lstrip=False, rstrip=False) if isinstance(pad_token, str) else pad_token
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
super().__init__(
|
76 |
bos_token=bos_token,
|
77 |
eos_token=eos_token,
|
|
|
83 |
clean_up_tokenization_spaces=clean_up_tokenization_spaces,
|
84 |
**kwargs,
|
85 |
)
|
86 |
+
self.vocab_file = vocab_file
|
87 |
+
self.add_bos_token = add_bos_token
|
88 |
+
self.add_eos_token = add_eos_token
|
89 |
+
self.sp_model = spm.SentencePieceProcessor(**self.sp_model_kwargs)
|
90 |
+
self.sp_model.Load(vocab_file)
|
91 |
|
92 |
def __getstate__(self):
|
93 |
state = self.__dict__.copy()
|