ByteDance-Seed / ByteDance-Seed/Bagel

Terrible Results in T2I Fine-tuining.

Open
#192 5 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
6.2k
Forks
545
PR merge metrics
No merged PRs in 30d

Description

After my tests, I discovered a very strange issue.
First, I fine-tuned on my T2I dataset. Below is the script I used for fine-tuning.
```bash
torchrun \
--nnodes=1 \
--node_rank=0 \
--nproc_per_node=8 \
--master_addr=127.0.0.1 \
--master_port=12345 \
train/pretrain_unified_navit.py \
--dataset_config_file ./data/configs/t2i.yaml \
--layer_module Qwen2MoTDecoderLayer \
--max_latent_size 64 \
--model_path $model_path \
--use_flex True \
--resume-from $model_path \
--finetune_from_hf True \
--auto_resume True \
--resume-model-only True \
--finetune-from-ema True \
--num_shard 8 \
--wandb_offline True \
--results_dir $output_path \
--checkpoint_dir $ckpt_path \
--log_every 10 \
--save_every 1000 \
--max_save_num 3 \
--lr 2e-6 \
--total_steps 20000 \
--visual_und False\
--expected_num_tokens 10240 \
--max_num_tokens 11520 \
--max_num_tokens_per_sample 10240 \
--num_workers 1
```
According to the training log, I found that the model experienced a sharp increase in loss around step 5000, which seemed to indicate a severe problem of knowledge forgetting.
![Image](https://github.com/user-attachments/assets/92443a1d-4e4c-41d3-a604-df18e95901c6)
The following is a comparison of the quantitative results between the fine-tuned model and the zero-shot model.
![Image](https://github.com/user-attachments/assets/c7fef3e3-f7e0-4cbd-a240-7e422a9aef5c)

Then, since the ckpt saved during training lacked the vit-related components (#160 ), I supplemented the vit components from the official model to the ckpt saved during training based on the script provided by @AbhinavJangra29 (🤗THANKS)
. After my tests, I found that the model with the supplemented vit performed slightly worse in inference results compared to the directly saved model. The quantitative results are as follows:
![Image](https://github.com/user-attachments/assets/745d8545-f66d-4241-95e4-4dae62a01bcb)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with train/pretrain_unified_navit.py and data/configs/t2i.yaml, reproducing the reported fine-tuning command and examining the loss near step 5000. Compare inference from the directly saved checkpoint with the checkpoint supplemented with ViT components, using the quantitative results in the issue as the baseline. Done means identifying and documenting the cause of the loss increase and checkpoint discrepancy, or confirming a reproducible fix.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
ai, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.