Views
No views yet
| Model | C-Eval | MMLU | CMMLU | GAOKAO | HumanEval | GSM8K | BBH | AGIEval |
|---|---|---|---|---|---|---|---|---|
| 5-shot | 5-shot | 5-shot | 5-shot | 0-shot | 8-shot | 3-shot | 5-shot | |
| GPT-4 | 68.4 | 83.9 | 70.3 | 66.2 | 69.5 | 90.0 | 75.1 | 63.3 |
| GPT-3.5 Turbo | 51.1 | 68.5 | 54.1 | 47.1 | 52.4 | 57.8 | 61.6 | 46.1 |
| LLaMA2-7B | 28.9 | 45.7 | 31.4 | 26.0 | 12.8 | 16.2 | 39.2 | 26.5 |
| ChatGLM2-6B* | 51.7 | 47.9 | - | - | - | 32.4 | 33.7 | - |
| Baichuan2-7B-Base* | 54.0 | 54.2 | 57.1 | 47.5 | 18.3 | 24.5 | 41.6 | 42.7 |
| Qwen-7B v1.1* | 63.5 | 58.2 | 62.2 | - | 29.9 | 51.7 | 45.0 | - |
| LingoWhale-8B-base | 63.6 | 60.2 | 62.8 | 50.3 | 32.9 | 55.0 | 47.5 | 43.8 |
生成以下样例的模型是使用开源SFT数据基于LingoWhale-8B模型进行微调后的对话模型
1import re
2
3def is_valid_phone(phone):
4 pattern = r'^1[3-9]\d{9}$'
5 return bool(re.match(pattern, phone))
6
7print(is_valid_phone('13800138000')) # True
8print(is_valid_phone('12345678901')) # Falsepip install -r requirements.txt1>>> from transformers import AutoModelForCausalLM, AutoTokenizer
2>>> tokenizer = AutoTokenizer.from_pretrained("deeplang-ai/LingoWhale-8B", trust_remote_code=True)
3>>> model = AutoModelForCausalLM.from_pretrained("deeplang-ai/LingoWhale-8B", device_map="auto", trust_remote_code=True)
4>>> inputs = tokenizer("陋室铭\n唐 刘禹锡\n", return_tensors="pt")
5>>> inputs = inputs.to("cuda:0")
6>>> pred = model.generate(**inputs, max_new_tokens=100, repetition_penalty=1.1)
7>>> print(tokenizer.decode(pred.cpu()[0], skip_special_tokens=True))transformers.Trainer为基础,其中大部分参数和使用方法都可以参考Huggingface中Trainer 的教程和介绍。本章节旨在展示微调过程,并不对该微调配置下进行微调后的模型效果进行保证。
1hostfile=""
2deepspeed --hostfile=$hostfile finetune/finetune.py \
3 --report_to "none" \
4 --data_path "finetune/data/coig_10k.json" \
5 --model_name_or_path deeplang-ai/LingoWhale-8B \
6 --output_dir "output" \
7 --model_max_length 2048 \
8 --num_train_epochs 4 \
9 --per_device_train_batch_size 4 \
10 --gradient_accumulation_steps 1 \
11 --save_strategy epoch \
12 --learning_rate 2e-5 \
13 --lr_scheduler_type constant \
14 --adam_beta1 0.9 \
15 --adam_beta2 0.98 \
16 --adam_epsilon 1e-8 \
17 --max_grad_norm 1.0 \
18 --weight_decay 1e-4 \
19 --warmup_ratio 0.0 \
20 --logging_steps 1 \
21 --gradient_checkpointing True \
22 --deepspeed finetune/ds_config.json \
23 --bf16 True \
24 --tf32 True1[
2 {
3 "id": 0,
4 "conversations": [
5 {
6 "from": "human",
7 "value": "请问什么是“模式年龄”?"
8 },
9 {
10 "from": "model",
11 "value": "模式年龄是指利用放射性衰变规律假定地质样品形成时的初始同位素组成计算得到的年龄。"
12 },
13 ...
14 ]
15 },
16 ...
17]hostfile文件。其中,每一行表示一个机器,ip_address-X为各个机器对应的ip地址,slots内容表示机器可用GPU数量。内容格式如下:ip_address-1 slots=8
ip_address-2 slots=8
ip_address-3 slots=8
ip_address-4 slots=8
...hostfile文件路径,然后运行如下命令即可启动多机训练。1hostfile="/path/to/hostfile"
2deepspeed --hostfile=$hostfile finetune/finetune.py \
3 --report_to "none" \
4 --data_path "finetune/data/coig_10k.json" \
5 --model_name_or_path deeplang-ai/LingoWhale-8B \
6 --output_dir "output" \
7 --model_max_length 2048 \
8 --num_train_epochs 4 \
9 --per_device_train_batch_size 4 \
10 --gradient_accumulation_steps 1 \
11 --save_strategy epoch \
12 --learning_rate 2e-5 \
13 --lr_scheduler_type constant \
14 --adam_beta1 0.9 \
15 --adam_beta2 0.98 \
16 --adam_epsilon 1e-8 \
17 --max_grad_norm 1.0 \
18 --weight_decay 1e-4 \
19 --warmup_ratio 0.0 \
20 --logging_steps 1 \
21 --gradient_checkpointing True \
22 --deepspeed finetune/ds_config.json \
23 --bf16 True \
24 --tf32 True--use_lora True启动。1from peft import AutoPeftModelForCausalLM
2model = AutoPeftModelForCausalLM.from_pretrained("output", trust_remote_code=True)