RangiLyu commited on
Commit
f470045
1 Parent(s): 5486307

update tokenizer and readme

Browse files
Files changed (2) hide show
  1. README.md +140 -2
  2. tokenizer_config.json +1 -1
README.md CHANGED
@@ -20,10 +20,16 @@ license: other
20
 
21
  [![evaluation](https://github.com/InternLM/InternLM/assets/22529082/f80a2a58-5ddf-471a-8da4-32ab65c8fd3b)](https://github.com/internLM/OpenCompass/)
22
 
23
- [💻Github Repo](https://github.com/InternLM/InternLM) • [🤔Reporting Issues](https://github.com/InternLM/InternLM/issues/new)
 
24
 
25
  </div>
26
 
 
 
 
 
 
27
 
28
  ## Introduction
29
 
@@ -94,10 +100,88 @@ for response, history in model.stream_chat(tokenizer, "Hello", history=[]):
94
  length = len(response)
95
  ```
96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  ## Open Source License
98
 
99
  The code is licensed under Apache-2.0, while model weights are fully open for academic research and also allow **free** commercial usage. To apply for a commercial license, please fill in the [application form (English)](https://wj.qq.com/s2/12727483/5dba/)/[申请表(中文)](https://wj.qq.com/s2/12725412/f7c1/). For other questions or collaborations, please contact <internlm@pjlab.org.cn>.
100
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  ## 简介
102
 
103
  InternLM2 ,即书生·浦语大模型第二代,开源了面向实用场景的70亿参数基础模型与对话模型 (InternLM2-Chat-7B)。模型具有以下特点:
@@ -163,6 +247,60 @@ for response, history in model.stream_chat(tokenizer, "你好", history=[]):
163
  length = len(response)
164
  ```
165
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
  ## 开源许可证
167
 
168
- 本仓库的代码依照 Apache-2.0 协议开源。模型权重对学术研究完全开放,也可申请免费的商业使用授权([申请表](https://wj.qq.com/s2/12725412/f7c1/))。其他问题与合作请联系 <internlm@pjlab.org.cn>。
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  [![evaluation](https://github.com/InternLM/InternLM/assets/22529082/f80a2a58-5ddf-471a-8da4-32ab65c8fd3b)](https://github.com/internLM/OpenCompass/)
22
 
23
+ [💻Github Repo](https://github.com/InternLM/InternLM) • [🤔Reporting Issues](https://github.com/InternLM/InternLM/issues/new)
24
+ [📜Technical Report](https://arxiv.org/abs/2403.17297)
25
 
26
  </div>
27
 
28
+ <p align="center">
29
+ 👋 join us on <a href="https://discord.gg/xa29JuW87d" target="_blank">Discord</a> and <a href="https://github.com/InternLM/InternLM/assets/25839884/a6aad896-7232-4220-ac84-9e070c2633ce" target="_blank">WeChat</a>
30
+ </p>
31
+
32
+
33
 
34
  ## Introduction
35
 
 
100
  length = len(response)
101
  ```
102
 
103
+ ## Deployment
104
+
105
+ ### LMDeploy
106
+
107
+ LMDeploy is a toolkit for compressing, deploying, and serving LLM, developed by the MMRazor and MMDeploy teams.
108
+
109
+ ```bash
110
+ pip install lmdeploy
111
+ ```
112
+
113
+ You can run batch inference locally with the following python code:
114
+
115
+ ```python
116
+ import lmdeploy
117
+ pipe = lmdeploy.pipeline("internlm/internlm-chat-7b")
118
+ response = pipe(["Hi, pls intro yourself", "Shanghai is"])
119
+ print(response)
120
+ ```
121
+
122
+ Or you can launch an OpenAI compatible server with the following command:
123
+
124
+ ```bash
125
+ lmdeploy serve api_server internlm/internlm2-chat-7b --model-name internlm2-chat-7b --server-port 23333
126
+ ```
127
+
128
+ ```bash
129
+ curl http://localhost:23333/v1/chat/completions \
130
+ -H "Content-Type: application/json" \
131
+ -d '{
132
+ "model": "internlm2-chat-7b",
133
+ "messages": [
134
+ {"role": "system", "content": "You are a helpful assistant."},
135
+ {"role": "user", "content": "Introduce deep learning to me."}
136
+ ]
137
+ }'
138
+ ```
139
+
140
+ Find more details in the [LMDeploy documentation](https://lmdeploy.readthedocs.io/en/latest/)
141
+
142
+ ### vLLM
143
+
144
+ Launch OpenAI compatible server with `vLLM>=0.3.2`:
145
+
146
+ ```bash
147
+ pip install vllm
148
+ ```
149
+
150
+ ```bash
151
+ python -m vllm.entrypoints.openai.api_server --model internlm/internlm2-chat-7b --served-model-name internlm2-chat-7b --trust-remote-code
152
+ ```
153
+
154
+ ```bash
155
+ curl http://localhost:8000/v1/chat/completions \
156
+ -H "Content-Type: application/json" \
157
+ -d '{
158
+ "model": "internlm2-chat-7b",
159
+ "messages": [
160
+ {"role": "system", "content": "You are a helpful assistant."},
161
+ {"role": "user", "content": "Introduce deep learning to me."}
162
+ ]
163
+ }'
164
+ ```
165
+
166
+ Find more details in the [vLLM documentation](https://docs.vllm.ai/en/latest/index.html)
167
+
168
  ## Open Source License
169
 
170
  The code is licensed under Apache-2.0, while model weights are fully open for academic research and also allow **free** commercial usage. To apply for a commercial license, please fill in the [application form (English)](https://wj.qq.com/s2/12727483/5dba/)/[申请表(中文)](https://wj.qq.com/s2/12725412/f7c1/). For other questions or collaborations, please contact <internlm@pjlab.org.cn>.
171
 
172
+ ## Citation
173
+
174
+ ```
175
+ @misc{cai2024internlm2,
176
+ title={InternLM2 Technical Report},
177
+ author={Zheng Cai and Maosong Cao and Haojiong Chen and Kai Chen and Keyu Chen and Xin Chen and Xun Chen and Zehui Chen and Zhi Chen and Pei Chu and Xiaoyi Dong and Haodong Duan and Qi Fan and Zhaoye Fei and Yang Gao and Jiaye Ge and Chenya Gu and Yuzhe Gu and Tao Gui and Aijia Guo and Qipeng Guo and Conghui He and Yingfan Hu and Ting Huang and Tao Jiang and Penglong Jiao and Zhenjiang Jin and Zhikai Lei and Jiaxing Li and Jingwen Li and Linyang Li and Shuaibin Li and Wei Li and Yining Li and Hongwei Liu and Jiangning Liu and Jiawei Hong and Kaiwen Liu and Kuikun Liu and Xiaoran Liu and Chengqi Lv and Haijun Lv and Kai Lv and Li Ma and Runyuan Ma and Zerun Ma and Wenchang Ning and Linke Ouyang and Jiantao Qiu and Yuan Qu and Fukai Shang and Yunfan Shao and Demin Song and Zifan Song and Zhihao Sui and Peng Sun and Yu Sun and Huanze Tang and Bin Wang and Guoteng Wang and Jiaqi Wang and Jiayu Wang and Rui Wang and Yudong Wang and Ziyi Wang and Xingjian Wei and Qizhen Weng and Fan Wu and Yingtong Xiong and Chao Xu and Ruiliang Xu and Hang Yan and Yirong Yan and Xiaogui Yang and Haochen Ye and Huaiyuan Ying and Jia Yu and Jing Yu and Yuhang Zang and Chuyu Zhang and Li Zhang and Pan Zhang and Peng Zhang and Ruijie Zhang and Shuo Zhang and Songyang Zhang and Wenjian Zhang and Wenwei Zhang and Xingcheng Zhang and Xinyue Zhang and Hui Zhao and Qian Zhao and Xiaomeng Zhao and Fengzhe Zhou and Zaida Zhou and Jingming Zhuo and Yicheng Zou and Xipeng Qiu and Yu Qiao and Dahua Lin},
178
+ year={2024},
179
+ eprint={2403.17297},
180
+ archivePrefix={arXiv},
181
+ primaryClass={cs.CL}
182
+ }
183
+ ```
184
+
185
  ## 简介
186
 
187
  InternLM2 ,即书生·浦语大模型第二代,开源了面向实用场景的70亿参数基础模型与对话模型 (InternLM2-Chat-7B)。模型具有以下特点:
 
247
  length = len(response)
248
  ```
249
 
250
+ ## 部署
251
+
252
+ ### LMDeploy
253
+
254
+ LMDeploy 由 MMDeploy 和 MMRazor 团队联合开发,是涵盖了 LLM 任务的全套轻量化、部署和服务解决方案。
255
+
256
+ ```bash
257
+ pip install lmdeploy
258
+ ```
259
+
260
+ 你可以使用以下 python 代码进行本地批量推理:
261
+
262
+ ```python
263
+ import lmdeploy
264
+ pipe = lmdeploy.pipeline("internlm/internlm-chat-7b")
265
+ response = pipe(["Hi, pls intro yourself", "Shanghai is"])
266
+ print(response)
267
+ ```
268
+
269
+ 或者你可以使用以下命令启动兼容 OpenAI API 的服务:
270
+
271
+ ```bash
272
+ lmdeploy serve api_server internlm/internlm2-chat-7b --server-port 23333
273
+ ```
274
+
275
+ 更多信息请查看 [LMDeploy 文档](https://lmdeploy.readthedocs.io/en/latest/)
276
+
277
+ ### vLLM
278
+
279
+ 使用`vLLM>=0.3.2`启动兼容 OpenAI API 的服务:
280
+
281
+ ```bash
282
+ pip install vllm
283
+ ```
284
+
285
+ ```bash
286
+ python -m vllm.entrypoints.openai.api_server --model internlm/internlm2-chat-7b --trust-remote-code
287
+ ```
288
+
289
+ 更多信息请查看 [vLLM 文档](https://docs.vllm.ai/en/latest/index.html)
290
+
291
  ## 开源许可证
292
 
293
+ 本仓库的代码依照 Apache-2.0 协议开源。模型权重对学术研究完全开放,也可申请免费的商业使用授权([申请表](https://wj.qq.com/s2/12725412/f7c1/))。其他问题与合作请联系 <internlm@pjlab.org.cn>。
294
+
295
+ ## 引用
296
+
297
+ ```
298
+ @misc{cai2024internlm2,
299
+ title={InternLM2 Technical Report},
300
+ author={Zheng Cai and Maosong Cao and Haojiong Chen and Kai Chen and Keyu Chen and Xin Chen and Xun Chen and Zehui Chen and Zhi Chen and Pei Chu and Xiaoyi Dong and Haodong Duan and Qi Fan and Zhaoye Fei and Yang Gao and Jiaye Ge and Chenya Gu and Yuzhe Gu and Tao Gui and Aijia Guo and Qipeng Guo and Conghui He and Yingfan Hu and Ting Huang and Tao Jiang and Penglong Jiao and Zhenjiang Jin and Zhikai Lei and Jiaxing Li and Jingwen Li and Linyang Li and Shuaibin Li and Wei Li and Yining Li and Hongwei Liu and Jiangning Liu and Jiawei Hong and Kaiwen Liu and Kuikun Liu and Xiaoran Liu and Chengqi Lv and Haijun Lv and Kai Lv and Li Ma and Runyuan Ma and Zerun Ma and Wenchang Ning and Linke Ouyang and Jiantao Qiu and Yuan Qu and Fukai Shang and Yunfan Shao and Demin Song and Zifan Song and Zhihao Sui and Peng Sun and Yu Sun and Huanze Tang and Bin Wang and Guoteng Wang and Jiaqi Wang and Jiayu Wang and Rui Wang and Yudong Wang and Ziyi Wang and Xingjian Wei and Qizhen Weng and Fan Wu and Yingtong Xiong and Chao Xu and Ruiliang Xu and Hang Yan and Yirong Yan and Xiaogui Yang and Haochen Ye and Huaiyuan Ying and Jia Yu and Jing Yu and Yuhang Zang and Chuyu Zhang and Li Zhang and Pan Zhang and Peng Zhang and Ruijie Zhang and Shuo Zhang and Songyang Zhang and Wenjian Zhang and Wenwei Zhang and Xingcheng Zhang and Xinyue Zhang and Hui Zhao and Qian Zhao and Xiaomeng Zhao and Fengzhe Zhou and Zaida Zhou and Jingming Zhuo and Yicheng Zou and Xipeng Qiu and Yu Qiao and Dahua Lin},
301
+ year={2024},
302
+ eprint={2403.17297},
303
+ archivePrefix={arXiv},
304
+ primaryClass={cs.CL}
305
+ }
306
+ ```
tokenizer_config.json CHANGED
@@ -93,7 +93,7 @@
93
  "chat_template": "{{ bos_token }}{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}",
94
  "clean_up_tokenization_spaces": false,
95
  "decode_with_prefix_space": false,
96
- "eos_token": "<|im_end|>",
97
  "model_max_length": 1000000000000000019884624838656,
98
  "pad_token": "</s>",
99
  "sp_model_kwargs": null,
 
93
  "chat_template": "{{ bos_token }}{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}",
94
  "clean_up_tokenization_spaces": false,
95
  "decode_with_prefix_space": false,
96
+ "eos_token": "</s>",
97
  "model_max_length": 1000000000000000019884624838656,
98
  "pad_token": "</s>",
99
  "sp_model_kwargs": null,