FastVideo icon indicating copy to clipboard operation
FastVideo copied to clipboard

hunyuan 全量微调,2台机器训练比单机慢10倍,请问是什么参数设置不对吗

Open yxqyyy opened this issue 1 year ago • 4 comments

2台机器训练比单机速度慢10倍,24s/iter->240s/iter。训练脚本是 node1节点 --node_rank=0 ,node2节点 --node_rank=1,分别在两个节点起如下脚本: torchrun --nnodes 2 --nproc_per_node 8 --node_rank=0 --master_addr="10.0.11.6" --master_port 29903
fastvideo/train.py
--seed 42
--pretrained_model_name_or_path ckpts/
--dit_model_name_or_path ckpts/hunyuan/hunyuan-video-t2v-720p/transformers/mp_rank_00_model_states.pt
--model_type "hunyuan"
--cache_dir data/.cache
--data_json_path data/Image-Vid-Finetune-HunYuan/videos2caption.json
--validation_prompt_dir data/Image-Vid-Finetune-HunYuan/validation
--gradient_checkpointing
--train_batch_size=1
--num_latent_t 32
--sp_size 4
--train_sp_batch_size 1
--dataloader_num_workers 4
--gradient_accumulation_steps=1
--max_train_steps=2000
--learning_rate=1e-5
--mixed_precision=bf16
--checkpointing_steps=200
--validation_steps 100
--validation_sampling_steps 50
--checkpoints_total_limit 3
--allow_tf32
--ema_start_step 0
--cfg 0.0
--ema_decay 0.999
--log_validation
--output_dir=data/outputs/HSH-Taylor-Finetune-Hunyuan
--tracker_project_name HSH-Taylor-Finetune-Hunyuan
--num_frames 125
--num_height 720
--num_width 1280
--shift 7
--validation_guidance_scale "1.0"

yxqyyy avatar Jan 16 '25 09:01 yxqyyy

I believe the bottleneck is in communication. Such issues would occur if cross-node communication is particularly slow. In our testing, we used GPUs with NVLink, so the situation was OK.

foreverpiano avatar Jan 16 '25 12:01 foreverpiano

I believe the bottleneck is in communication. Such issues would occur if cross-node communication is particularly slow. In our testing, we used GPUs with NVLink, so the situation was OK.

用的H100 GPU,之前跑其他多机训练代码的时候多机通信好像没有这么慢,不知道是否可以共享下你们多机训练的脚本呢?

yxqyyy avatar Jan 17 '25 01:01 yxqyyy

I didn't separate multi-node and single-node cases. Our script runs on 4 nodes as shown. Can you test the cross-node communication speed? I think it's a communication issue.

export WANDB_BASE_URL="https://api.wandb.ai"
export WANDB_MODE=online

DATA_DIR=./data
IP=[MASTER NODE IP]

torchrun --nnodes 4 --nproc_per_node 8\
    --node_rank=0 \
    --rdzv_id=456 \
    --rdzv_backend=c10d \
    --rdzv_endpoint=$IP:29500 \
    fastvideo/distill.py\
    --seed 42\
    --pretrained_model_name_or_path $DATA_DIR/hunyuan\
    --dit_model_name_or_path $DATA_DIR/hunyuan/hunyuan-video-t2v-720p/transformers/mp_rank_00_model_states.pt\
    --model_type "hunyuan" \
    --cache_dir "$DATA_DIR/.cache"\
    --data_json_path "$DATA_DIR/HD-Mixkit-Finetune-Hunyuan/videos2caption.json"\
    --validation_prompt_dir "$DATA_DIR/HD-Mixkit-Finetune-Hunyuan/validation"\
    --gradient_checkpointing\
    --train_batch_size=1\
    --num_latent_t 32 \
    --sp_size 2 \
    --train_sp_batch_size 1\
    --dataloader_num_workers 4\
    --gradient_accumulation_steps=1\
    --max_train_steps=320\
    --learning_rate=1e-6\
    --mixed_precision="bf16"\
    --checkpointing_steps=64\
    --validation_steps 64\
    --validation_sampling_steps "2,4,8" \
    --checkpoints_total_limit 3\
    --allow_tf32\
    --ema_start_step 0\
    --cfg 0.0\
    --log_validation\
    --output_dir="$DATA_DIR/outputs/hy_phase1_shift17_bs_16_HD"\
    --tracker_project_name Hunyuan_Distill \
    --num_height 720 \
    --num_width 1280 \
    --num_frames  125 \
    --shift 17 \
    --validation_guidance_scale "1.0" \
    --num_euler_timesteps 50 \
    --multi_phased_distill_schedule "4000-1" \
    --not_apply_cfg_solver 

foreverpiano avatar Jan 17 '25 04:01 foreverpiano

Did you solve the issue? I will re-open it if you still have question.

foreverpiano avatar Jan 21 '25 04:01 foreverpiano