Views
No views yet
| Datasets\Models | InternLM-Chat-7B | InternLM-7B | LLaMA-7B | Baichuan-7B | ChatGLM2-6B | Alpaca-7B | Vicuna-7B |
|---|---|---|---|---|---|---|---|
| C-Eval(Val) | 53.2 | 53.4 | 24.2 | 42.7 | 50.9 | 28.9 | 31.2 |
| MMLU | 50.8 | 51.0 | 35.2* | 41.5 | 46.0 | 39.7 | 47.3 |
| AGIEval | 42.5 | 37.6 | 20.8 | 24.6 | 39.0 | 24.1 | 26.4 |
| CommonSenseQA | 75.2 | 59.5 | 65.0 | 58.8 | 60.0 | 68.7 | 66.7 |
| BUSTM | 74.3 | 50.6 | 48.5 | 51.3 | 55.0 | 48.8 | 62.5 |
| CLUEWSC | 78.6 | 59.1 | 50.3 | 52.8 | 59.8 | 50.3 | 52.2 |
| MATH | 6.4 | 7.1 | 2.8 | 3.0 | 6.6 | 2.2 | 2.8 |
| GSM8K | 34.5 | 31.2 | 10.1 | 9.7 | 29.2 | 6.0 | 15.3 |
| HumanEval | 14.0 | 10.4 | 14.0 | 9.2 | 9.2 | 9.2 | 11.0 |
| RACE(High) | 76.3 | 57.4 | 46.9* | 28.1 | 66.3 | 40.7 | 54.0 |
1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
3tokenizer = AutoTokenizer.from_pretrained("internlm/internlm-chat-7b", 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/internlm-chat-7b", 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)
12# Sure, here are three tips for effective time management:
13#
14# 1. Prioritize tasks based on importance and urgency: Make a list of all your tasks and categorize them into "important and urgent," "important but not urgent," and "not important but urgent." Focus on completing the tasks in the first category before moving on to the others.
15# 2. Use a calendar or planner: Write down deadlines and appointments in a calendar or planner so you don't forget them. This will also help you schedule your time more effectively and avoid overbooking yourself.
16# 3. Minimize distractions: Try to eliminate any potential distractions when working on important tasks. Turn off notifications on your phone, close unnecessary tabs on your computer, and find a quiet place to work if possible.
17#
18# Remember, good time management skills take practice and patience. Start with small steps and gradually incorporate these habits into your daily routine.stream_chat:1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4model_path = "internlm/internlm-chat-7b"
5model = AutoModelForCausalLM.from_pretrained(model_path, torch_dtype=torch.float16, trust_remote_code=True)
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)1pip install streamlit==1.24.0
2pip install transformers==4.30.2
3streamlit run web_demo.py| 数据集\模型 | InternLM-Chat-7B | InternLM-7B | LLaMA-7B | Baichuan-7B | ChatGLM2-6B | Alpaca-7B | Vicuna-7B |
|---|---|---|---|---|---|---|---|
| C-Eval(Val) | 53.2 | 53.4 | 24.2 | 42.7 | 50.9 | 28.9 | 31.2 |
| MMLU | 50.8 | 51.0 | 35.2* | 41.5 | 46.0 | 39.7 | 47.3 |
| AGIEval | 42.5 | 37.6 | 20.8 | 24.6 | 39.0 | 24.1 | 26.4 |
| CommonSenseQA | 75.2 | 59.5 | 65.0 | 58.8 | 60.0 | 68.7 | 66.7 |
| BUSTM | 74.3 | 50.6 | 48.5 | 51.3 | 55.0 | 48.8 | 62.5 |
| CLUEWSC | 78.6 | 59.1 | 50.3 | 52.8 | 59.8 | 50.3 | 52.2 |
| MATH | 6.4 | 7.1 | 2.8 | 3.0 | 6.6 | 2.2 | 2.8 |
| GSM8K | 34.5 | 31.2 | 10.1 | 9.7 | 29.2 | 6.0 | 15.3 |
| HumanEval | 14.0 | 10.4 | 14.0 | 9.2 | 9.2 | 9.2 | 11.0 |
| RACE(High) | 76.3 | 57.4 | 46.9* | 28.1 | 66.3 | 40.7 | 54.0 |
*代表数据来自原始论文),具体测试细节可参见 OpenCompass 中提供的配置文件。1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
3tokenizer = AutoTokenizer.from_pretrained("internlm/internlm-chat-7b", trust_remote_code=True)
4# `torch_dtype=torch.float16` 可以令模型以 float16 精度加载,否则 transformers 会将模型加载为 float32,导致显存不足
5model = AutoModelForCausalLM.from_pretrained("internlm/internlm-chat-7b", 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)
12# 当然可以!以下是三个管理时间的建议:
13# 1. 制定计划:制定一个详细的计划,包括每天要完成的任务和活动。这将有助于您更好地组织时间,并确保您能够按时完成任务。
14# 2. 优先级:将任务按照优先级排序,先完成最重要的任务。这将确保您能够在最短的时间内完成最重要的任务,从而节省时间。
15# 3. 集中注意力:避免分心,集中注意力完成任务。关闭社交媒体和电子邮件通知,专注于任务,这将帮助您更快地完成任务,并减少错误的可能性。stream_chat 接口:1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4model_path = "internlm/internlm-chat-7b"
5model = AutoModelForCausalLM.from_pretrained(model_path, torch_dype=torch.float16, trust_remote_code=True)
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)1pip install streamlit==1.24.0
2pip install transformers==4.30.2
3streamlit run web_demo.py