Views
No views yet
| Benchmark | InternLM2.5-1.8B-Chat | MiniCPM-2 | Qwen2-1.5B-Instruct |
|---|---|---|---|
| MMLU (5-shot) | 50.7 | 54.2 | 55.7 |
| CMMLU (5-shot) | 62.2 | 50.6 | 65.2 |
| BBH (3-shot CoT) | 41.9 | 41.5 | 36.5 |
| MATH (0-shot CoT) | 40.2 | 15.5 | 21.4 |
| GPQA (0-shot) | 27.8 | 23.7 | 27.3 |
1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
3tokenizer = AutoTokenizer.from_pretrained("internlm/internlm2_5-1_8b-chat", trust_remote_code=True)
4# Set `torch_dtype=torch.float16` to load model in float16, otherwise it will be loaded as float32 and cause OOM Error.
5model = AutoModelForCausalLM.from_pretrained("internlm/internlm2_5-1_8b-chat", torch_dtype=torch.float16, trust_remote_code=True).cuda()
6model = model.eval()
7response, history = model.chat(tokenizer, "hello", history=[])
8print(response)
9# Hello! How can I help you today?
10response, history = model.chat(tokenizer, "please provide three suggestions about time management", history=history)
11print(response)stream_chat:1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4model_path = "internlm/internlm2_5-1_8b-chat"
5model = AutoModelForCausalLM.from_pretrained(model_path, torch_dtype=torch.float16, trust_remote_code=True).cuda()
6tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
7
8model = model.eval()
9length = 0
10for response, history in model.stream_chat(tokenizer, "Hello", history=[]):
11 print(response[length:], flush=True, end="")
12 length = len(response)pip install lmdeploy1import lmdeploy
2pipe = lmdeploy.pipeline("internlm/internlm2_5-1_8b-chat")
3response = pipe(["Hi, pls intro yourself", "Shanghai is"])
4print(response)lmdeploy serve api_server internlm/internlm2_5-1_8b-chat --model-name internlm2_5-1_8b-chat --server-port 23333 1curl http://localhost:23333/v1/chat/completions \
2 -H "Content-Type: application/json" \
3 -d '{
4 "model": "internlm2_5-1_8b-chat",
5 "messages": [
6 {"role": "system", "content": "You are a helpful assistant."},
7 {"role": "user", "content": "Introduce deep learning to me."}
8 ]
9 }'vLLM>=0.3.2:pip install vllmpython -m vllm.entrypoints.openai.api_server --model internlm/internlm2_5-1_8b-chat --served-model-name internlm2_5-1_8b-chat --trust-remote-code1curl http://localhost:8000/v1/chat/completions \
2 -H "Content-Type: application/json" \
3 -d '{
4 "model": "internlm2_5-1_8b-chat",
5 "messages": [
6 {"role": "system", "content": "You are a helpful assistant."},
7 {"role": "user", "content": "Introduce deep learning to me."}
8 ]
9 }'@misc{cai2024internlm2,
title={InternLM2 Technical Report},
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},
year={2024},
eprint={2403.17297},
archivePrefix={arXiv},
primaryClass={cs.CL}
}| Benchmark | InternLM2.5-1.8B-Chat | MiniCPM-2 | Qwen2-1.5B-Instruct |
|---|---|---|---|
| MMLU (5-shot) | 50.7 | 54.2 | 55.7 |
| CMMLU (5-shot) | 62.2 | 50.6 | 65.2 |
| BBH (3-shot CoT) | 41.9 | 41.5 | 36.5 |
| MATH (0-shot CoT) | 40.2 | 15.5 | 21.4 |
| GPQA (0-shot) | 27.8 | 23.7 | 27.3 |
1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
3tokenizer = AutoTokenizer.from_pretrained("internlm/internlm2_5-1_8b-chat", trust_remote_code=True)
4# `torch_dtype=torch.float16` 可以令模型以 float16 精度加载,否则 transformers 会将模型加载为 float32,导致显存不足
5model = AutoModelForCausalLM.from_pretrained("internlm/internlm2_5-1_8b-chat", torch_dtype=torch.float16, trust_remote_code=True).cuda()
6model = model.eval()
7response, history = model.chat(tokenizer, "你好", history=[])
8print(response)
9# 你好!有什么我可以帮助你的吗?
10response, history = model.chat(tokenizer, "请提供三个管理时间的建议。", history=history)
11print(response)stream_chat 接口:1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4model_path = "internlm/internlm2_5-1_8b-chat"
5model = AutoModelForCausalLM.from_pretrained(model_path, torch_dype=torch.float16, trust_remote_code=True).cuda()
6tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
7
8model = model.eval()
9length = 0
10for response, history in model.stream_chat(tokenizer, "你好", history=[]):
11 print(response[length:], flush=True, end="")
12 length = len(response)pip install lmdeploy1import lmdeploy
2pipe = lmdeploy.pipeline("internlm/internlm2_5-1_8b-chat")
3response = pipe(["Hi, pls intro yourself", "Shanghai is"])
4print(response)lmdeploy serve api_server internlm/internlm2_5-1_8b-chat --model-name internlm2_5-1_8b-chat --server-port 233331curl http://localhost:23333/v1/chat/completions \
2 -H "Content-Type: application/json" \
3 -d '{
4 "model": "internlm2_5-1_8b-chat",
5 "messages": [
6 {"role": "system", "content": "你是个友善的AI助手。"},
7 {"role": "user", "content": "介绍一下深度学习。"}
8 ]
9 }'vLLM>=0.3.2启动兼容 OpenAI API 的服务:pip install vllmpython -m vllm.entrypoints.openai.api_server --model internlm/internlm2_5-1_8b-chat --served-model-name internlm2_5-1_8b-chat --trust-remote-code1curl http://localhost:8000/v1/chat/completions \
2 -H "Content-Type: application/json" \
3 -d '{
4 "model": "internlm2_5-1_8b-chat",
5 "messages": [
6 {"role": "system", "content": "你是个友善的AI助手。"},
7 {"role": "user", "content": "介绍一下深度学习。"}
8 ]
9 }'@misc{cai2024internlm2,
title={InternLM2 Technical Report},
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},
year={2024},
eprint={2403.17297},
archivePrefix={arXiv},
primaryClass={cs.CL}
}