IEIT-Yuan / Yuan-2.0

Yuan 2.0 Large Language Model
Other
681 stars 85 forks source link

LLaMA调参方式下,能否区分/指定训练集与测试集 #118

Open fredfany opened 7 months ago

fredfany commented 7 months ago

如题,通过“--dataset custom1”指定了微调数据集,如何区分训练集与测试集,换言之,没有看到指定测试集的地方。 因此可能出现loss值很低,但是明显过拟合的情况。请指导一下,谢谢。

deepspeed --num_gpus=8 src/train_bash.py \
        --stage sft \
        --model_name_or_path /workspace/model/Yuan2-2B-hf/ \
        --do_train \
        --dataset custom1 \
        --finetuning_type full  \
        --output_dir /workspace/pretrain/yuan2_2B_full_fintuning_checkpoint2 \
        --overwrite_cache \
        --per_device_train_batch_size 4 \
        --per_device_eval_batch_size 4  \
        --gradient_accumulation_steps 4  \
        --preprocessing_num_workers 16 \
        --lr_scheduler_type cosine \
        --logging_steps 10    \
        --save_steps 10000   \
        --learning_rate 5e-5   \
        --max_grad_norm 0.5     \
        --num_train_epochs 3000   \
        --evaluation_strategy no  \
        --bf16 \
        --deepspeed ./zero2_ds_woloading.json \
        --template yuan \
        --overwrite_output_dir     \
        --cutoff_len 2048\
        --sft_packing   \
        --gradient_checkpointing True 
Shawn-IEITSystems commented 7 months ago

@zhaoxudong01

wangpengfei1013 commented 7 months ago

如题,通过“--dataset custom1”指定了微调数据集,如何区分训练集与测试集,换言之,没有看到指定测试集的地方。 因此可能出现loss值很低,但是明显过拟合的情况。请指导一下,谢谢。

deepspeed --num_gpus=8 src/train_bash.py \
        --stage sft \
        --model_name_or_path /workspace/model/Yuan2-2B-hf/ \
        --do_train \
        --dataset custom1 \
        --finetuning_type full  \
        --output_dir /workspace/pretrain/yuan2_2B_full_fintuning_checkpoint2 \
        --overwrite_cache \
        --per_device_train_batch_size 4 \
        --per_device_eval_batch_size 4  \
        --gradient_accumulation_steps 4  \
        --preprocessing_num_workers 16 \
        --lr_scheduler_type cosine \
        --logging_steps 10    \
        --save_steps 10000   \
        --learning_rate 5e-5   \
        --max_grad_norm 0.5     \
        --num_train_epochs 3000   \
        --evaluation_strategy no  \
        --bf16 \
        --deepspeed ./zero2_ds_woloading.json \
        --template yuan \
        --overwrite_output_dir     \
        --cutoff_len 2048\
        --sft_packing   \
        --gradient_checkpointing True 

我暂时没有发现在微调过程中添加评估数据集的方法,llama-factory实际的评估都是在微调完成后使用--do_eval参数找对应数据集作评估的。https://github.com/hiyouga/LLaMA-Factory/tree/9c10854b46fc67d45ff9fc2f62af4d6af826f9c1?tab=readme-ov-file#evaluation

Shawn-IEITSystems commented 7 months ago

目前开源的代码中,确实不支持在训练中进行评估。目前的做法是训练之后在验证集或测试集上做评估,或者在下游任务上做评测(需要开发额外的代码)。 因为这套开源代码微调的逻辑与预训练相同,但在微调情况下确实需要即时的评估支持,这部分我们会跟进并添加上相关功能。 感谢!

Shawn-IEITSystems commented 7 months ago

@fredfany 目前需要的功能是否是在验证集上计算loss或perplexity?