Skip to content

Qwen2.5-vl预训练过程中loss突然激增 #4634

@rainstorm12

Description

@rainstorm12

我用Qwen2.5-vl-7b模型实验了一下预训练,发现训练开始时候正常,过一段时间之后loss和grad norm都突然激增,想问问别的朋友有遇到过这种情况吗?

配置文件如下:

NPROC_PER_NODE=3 \
MAX_PIXELS=1003520 \
CUDA_VISIBLE_DEVICES=0,1,2 \
swift pt \
    --model /mypath/model_hub/Qwen/Qwen2.5-VL-7B-Instruct \
    --train_type full \
    --dataset /mypath/myfile.jsonl \
    --torch_dtype bfloat16 \
    --attn_impl flash_attn \
    --freeze_vit false \
    --freeze_llm false \
    --freeze_aligner false \
    --num_train_epochs 1 \
    --per_device_train_batch_size 2 \
    --per_device_eval_batch_size 2 \
    --learning_rate 1e-5 \
    --gradient_accumulation_steps 2 \
    --eval_steps 1000 \
    --save_steps 1000 \
    --logging_steps 5 \
    --max_length 4096 \
    --output_dir output/Qwen2_5_VL \
    --dataloader_num_workers 2 \
    --dataset_num_proc 8 \
    --deepspeed zero3 \
    --padding_free true \

训练数据总数大概有15w左右个图文对,大概训练到5w组数据的时候,发现loss曲线升起来了:

Image

grad norm也飙升得很高:

Image

另外想问一下padding_free true的作用到底什么呢,我看其他的issue说pack有问题所以用padding_free,但是padding_free时候我发现数据并没有拼起来,还是每个step取的一条原始数据来训练的。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions