chatglm2微调—Freeze

Freeze: 即参数冻结,对原始模型部分参数进行冻结操作,仅训练部分参数,以达到在单卡或不进行TP或PP操作,就可以对大模型进行训练。

Freeze仅训练模型后五层的全连接层参数

训练、评估也是基于ChatGLM-Efficient-Tuning框架,具体配置看上一篇博客

1.训练

CUDA_VISIBLE_DEVICES=0 python ../src/train_bash.py \
    --do_train \
    --model_name_or_path /home/xx/ChatGLM2-6B/model \
    --dataset alpaca_gpt4_zh \
    --dataset_dir ../data \
    --finetuning_type freeze \
    --output_dir /home/xx/ChatGLM-Efficient-Tuning/output/freeze_ckp \
    --overwrite_cache \
    --per_device_train_batch_size 4 \
    --gradient_accumulation_steps 4 \
    --lr_scheduler_type cosine \
    --logging_steps 10 \
    --save_steps 1000 \
    --learning_rate 5e-5 \
    --num_train_epochs 3.0 \
    --plot_loss \
    --fp16

2.评估

CUDA_VISIBLE_DEVICES=0 python ../src/train_bash.py \
    --do_eval \
    --model_name_or_path /home/lenovo/ChatGLM2-6B/model \
    --dataset alpaca_gpt4_zh \
    --dataset_dir ../data \
    --finetuning_type freeze \
    --checkpoint_dir /home/lenovo/ChatGLM-Efficient-Tuning/output/freeze_ckp \
    --output_dir /home/lenovo/ChatGLM-Efficient-Tuning/eval/freeze \
    --overwrite_cache \
    --per_device_eval_batch_size 8 \
    --max_samples 50 \
    --predict_with_generate

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值