From e4eeae93e6bcc7ebef7aa17d00bf3c314b1b10e6 Mon Sep 17 00:00:00 2001 From: SolitaryThinker Date: Sun, 22 Jun 2025 03:44:57 -0700 Subject: [PATCH] exmaple scripts --- .../crush_smol/finetune_v1.sh | 51 +++++++++++++++++++ .../crush_smol/v1_preprocess_wan_data_i2v.sh | 24 +++++++++ 2 files changed, 75 insertions(+) create mode 100644 examples/training/finetune/wan_i2v_14b_480p/crush_smol/finetune_v1.sh create mode 100644 examples/training/finetune/wan_i2v_14b_480p/crush_smol/v1_preprocess_wan_data_i2v.sh diff --git a/examples/training/finetune/wan_i2v_14b_480p/crush_smol/finetune_v1.sh b/examples/training/finetune/wan_i2v_14b_480p/crush_smol/finetune_v1.sh new file mode 100644 index 000000000..f3110068d --- /dev/null +++ b/examples/training/finetune/wan_i2v_14b_480p/crush_smol/finetune_v1.sh @@ -0,0 +1,51 @@ +export WANDB_BASE_URL="https://api.wandb.ai" +export WANDB_MODE=online +# export FASTVIDEO_ATTENTION_BACKEND=TORCH_SDPA + +DATA_DIR="data/crush-smol_processed/combined_parquet_dataset/" +VALIDATION_DIR="data/crush-smol_processed/validation_parquet_dataset/" +NUM_GPUS=8 +# export CUDA_VISIBLE_DEVICES=4,5 +# IP=[MASTER NODE IP] + +# If you do not have 32 GPUs and to fit in memory, you can: 1. increase sp_size. 2. reduce num_latent_t +torchrun --nnodes 1 --nproc_per_node $NUM_GPUS\ + fastvideo/v1/training/wan_training_pipeline.py\ + --model_path Wan-AI/Wan2.1-I2V-14B-480P-Diffusers \ + --inference_mode False\ + --pretrained_model_name_or_path Wan-AI/Wan2.1-I2V-14B-480P-Diffusers \ + --data_path "$DATA_DIR"\ + --validation_preprocessed_path "$VALIDATION_DIR"\ + --train_batch_size=1 \ + --num_latent_t 16 \ + --sp_size 8 \ + --tp_size 8 \ + --hsdp_replicate_dim 1 \ + --hsdp_shard_dim 8 \ + --num_gpus $NUM_GPUS \ + --train_sp_batch_size 1\ + --dataloader_num_workers 10\ + --gradient_accumulation_steps=8 \ + --max_train_steps=5000 \ + --learning_rate=1e-5\ + --mixed_precision="bf16"\ + --checkpointing_steps=6000 \ + --validation_steps 100\ + --validation_sampling_steps "40" \ + --log_validation \ + --checkpoints_total_limit 3\ + --allow_tf32\ + --ema_start_step 0\ + --cfg 0.0\ + --output_dir="$DATA_DIR/outputs/wan_i2v_finetune"\ + --tracker_project_name wan_i2v_finetune \ + --num_height 480 \ + --num_width 832 \ + --num_frames 77 \ + --validation_guidance_scale "1.0" \ + --num_euler_timesteps 50 \ + --multi_phased_distill_schedule "4000-1" \ + --weight_decay 1e-4 \ + --not_apply_cfg_solver \ + --dit_precision "fp32" \ + --max_grad_norm 1.0 \ No newline at end of file diff --git a/examples/training/finetune/wan_i2v_14b_480p/crush_smol/v1_preprocess_wan_data_i2v.sh b/examples/training/finetune/wan_i2v_14b_480p/crush_smol/v1_preprocess_wan_data_i2v.sh new file mode 100644 index 000000000..3ba576017 --- /dev/null +++ b/examples/training/finetune/wan_i2v_14b_480p/crush_smol/v1_preprocess_wan_data_i2v.sh @@ -0,0 +1,24 @@ +# export WANDB_MODE="offline" +GPU_NUM=1 # 2,4,8 +MODEL_PATH="Wan-AI/Wan2.1-I2V-14B-480P-Diffusers" +MODEL_TYPE="wan" +DATA_MERGE_PATH="data/crush-smol/merge.txt" +OUTPUT_DIR="data/crush-smol_processed/" +VALIDATION_PATH="examples/training/finetune/wan_i2v_14b_480p/crush_smol/validation.json" + +torchrun --nproc_per_node=$GPU_NUM \ + fastvideo/v1/pipelines/preprocess/v1_preprocess.py \ + --model_path $MODEL_PATH \ + --data_merge_path $DATA_MERGE_PATH \ + --preprocess_video_batch_size 8 \ + --max_height 480 \ + --max_width 832 \ + --num_frames 77 \ + --dataloader_num_workers 0 \ + --output_dir=$OUTPUT_DIR \ + --model_type $MODEL_TYPE \ + --train_fps 16 \ + --validation_dataset_file $VALIDATION_PATH \ + --samples_per_file 8 \ + --flush_frequency 8 \ + --preprocess_task "i2v" \ No newline at end of file