Train_loss = 0 and Eval_loss = NaN in stage2_sft
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 882
- Forks
- 76
- PR merge metrics
- No merged PRs in 30d
Description
Hello!
Thank you for your work at MLLM.
I had a fine-tuning bug that I couldn't fix: when I ran the stage2_sft.sh script and trained with speech_conv_datasets only, the logger showed that the train loss was 0 all the time and eval loss was NaN, as shown in the figure.
Command in stage2_sft.sh as follows:
torchrun
--nproc_per_node 2 \
anygpt/src/train/stage2_sft.py \
--model_name_or_path "${METAROOT}" \
--run_name "mm_sft" \
--cache_dir ${CACHEROOT} \
--report_to "wandb" \
--speech_conv_datasets "$speech_conv_datasets" \
--speech_datasets "$speech_datasets"\
--preprocessing_num_workers 100 \
--bf16 True \
--do_train \
--do_eval \
--output_dir "${OUTROOT}" \
--model_max_length 4096 \
--save_strategy "steps" \
--save_steps 5 \
--evaluation_strategy "steps" \
--eval_steps 5 \
--max_steps 5 \
--concatenating False \
--per_device_train_batch_size 1 \
--per_device_eval_batch_size 4 \
--gradient_accumulation_steps 1 \
--val_set_size 10 \
--num_train_epochs 3\
--learning_rate 2e-5 \
--weight_decay 0. \
--warmup_ratio 0.03 \
--lr_scheduler_type "cosine" \
--log_level debug \
--logging_steps 1 \
--overwrite_output_dir False\
--fsdp "full_shard auto_wrap" \
--fsdp_transformer_layer_cls_to_wrap 'LlamaDecoderLayer' \
--use_flash_attn True \
--ddp_timeout 7200 \
--save_total_limit 10
I'm using the following python environment:
transformers 4.34.1
huggingface-hub 0.24.0
tokenizers 0.14.1
torch 2.1.0
torchaudio 2.1.0
torchvision 0.16.0
flash-attn 2.5.9.post1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with stage2_sft.sh and anygpt/src/train/stage2_sft.py, then trace the speech_conv_datasets-only training and evaluation paths. Reproduce the command with the listed environment versions and inspect dataset batches, labels, and loss logging; done means finite, nonzero train and evaluation losses are reported for this configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100