Skip to content

CPT阶段,采用36w条医疗数据集,训练一轮后loss从23.1-17.5左右正常吗 #445

@ygyang11

Description

@ygyang11

如题,脚本参数如下,一共3813steps,在差不多400步的时候就已经降到18.2左右了,剩下的几千步降的很慢,且有震荡,不过eval_loss稳步下降。问题如下

  1. 这个loss正常吗,怎么开始loss就23这么高?
  2. 这个训练过程正常吗,训练了1轮loss17.5,感觉得训个10轮啊,但是数据量又不大是否会过拟合?请问您训练了几轮?
    3.我看工程经验中说到CPT阶段lr基本上设置为PT阶段的0.1,PT一般是3e-4,那CPT阶段应该是3e-5,请问默认参数2e-4会不会太大,导致难以收敛?

Image

Image

CUDA_VISIBLE_DEVICES=0,1 torchrun --nproc_per_node 2 pretraining.py \
    --model_name_or_path ./Baichuan2-13B-Chat \
    --train_file_dir ./Medical_data/medical/pretrain/train \
    --validation_file_dir ./Medical_data/medical/pretrain/valid \
    --per_device_train_batch_size 4 \
    --per_device_eval_batch_size 4 \
    --do_train \
    --do_eval \
    --use_peft True \
    --seed 42 \
    --max_train_samples -1 \
    --max_eval_samples 500 \
    --num_train_epochs 1 \
    --learning_rate 2e-4 \
    --warmup_ratio 0.05 \
    --weight_decay 0.01 \
    --logging_strategy steps \
    --logging_steps 10 \
    --eval_steps 50 \
    --evaluation_strategy steps \
    --save_steps 500 \
    --save_strategy steps \
    --save_total_limit 13 \
    --gradient_accumulation_steps 8 \
    --preprocessing_num_workers 10 \
    --block_size 512 \
    --group_by_length True \
    --output_dir outputs-pt-baichuan-v2 \
    --overwrite_output_dir \
    --ddp_timeout 30000 \
    --logging_first_step True \
    --target_modules all \
    --lora_rank 8 \
    --lora_alpha 16 \
    --lora_dropout 0.05 \
    --torch_dtype bfloat16 \
    --bf16 \
    --report_to tensorboard \
    --ddp_find_unused_parameters False \
    --gradient_checkpointing True \
    --cache_dir ./cache \
    --deepspeed zero2.json \
    --device_map auto \

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions