diff --git a/.gitignore b/.gitignore index 479088db7..bb17640a5 100644 --- a/.gitignore +++ b/.gitignore @@ -67,4 +67,3 @@ docs/source/distillation/examples/ dmd_t2v_output/ preprocess_output_text/ -wan2.2_train.sh \ No newline at end of file diff --git a/examples/inference/basic/basic.py b/examples/inference/basic/basic.py index 316621eaf..f12a4969e 100644 --- a/examples/inference/basic/basic.py +++ b/examples/inference/basic/basic.py @@ -9,9 +9,9 @@ def main(): # If a local path is provided, FastVideo will make a best effort # attempt to identify the optimal arguments. generator = VideoGenerator.from_pretrained( - "Wan-AI/Wan2.1-T2V-14B-Diffusers", + "Wan-AI/Wan2.1-T2V-1.3B-Diffusers", # FastVideo will automatically handle distributed setup - num_gpus=4, + num_gpus=1, use_fsdp_inference=True, dit_cpu_offload=False, vae_cpu_offload=False, @@ -25,7 +25,9 @@ def main(): # sampling_param.image_path = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/astronaut.jpg" # Generate videos with the same simple API, regardless of GPU count prompt = ( - "A watermelon wearing a helmet is crushed by a hydraulic press, causing it to flatten and burst open." + "A curious raccoon peers through a vibrant field of yellow sunflowers, its eyes " + "wide with interest. The playful yet serene atmosphere is complemented by soft " + "natural light filtering through the petals. Mid-shot, warm and cheerful tones." ) video = generator.generate_video(prompt, output_path=OUTPUT_PATH, save_video=True) # video = generator.generate_video(prompt, sampling_param=sampling_param, output_path="wan_t2v_videos/") @@ -33,7 +35,11 @@ def main(): # Generate another video with a different prompt, without reloading the # model! prompt2 = ( - "The video shows a green and orange object being flattened as if it were under a hydraulic press, with the press moving down and compressing the object") + "A majestic lion strides across the golden savanna, its powerful frame " + "glistening under the warm afternoon sun. The tall grass ripples gently in " + "the breeze, enhancing the lion's commanding presence. The tone is vibrant, " + "embodying the raw energy of the wild. Low angle, steady tracking shot, " + "cinematic.") video2 = generator.generate_video(prompt2, output_path=OUTPUT_PATH, save_video=True) diff --git a/fastvideo/layers/layernorm.py b/fastvideo/layers/layernorm.py index 66d5101d1..d93e1d966 100644 --- a/fastvideo/layers/layernorm.py +++ b/fastvideo/layers/layernorm.py @@ -276,4 +276,4 @@ class LayerNormScaleShift(nn.Module): if self.compute_dtype == torch.float32: output = output.to(x.dtype) - return output \ No newline at end of file + return output diff --git a/wan2.2_train.sh b/wan2.2_train.sh deleted file mode 100644 index b83433860..000000000 --- a/wan2.2_train.sh +++ /dev/null @@ -1,57 +0,0 @@ -export WANDB_BASE_URL="https://api.wandb.ai" -export WANDB_MODE=online -export WANDB_API_KEY='your_wandb_api_key_here' -# export FASTVIDEO_ATTENTION_BACKEND=TORCH_SDPA -export TRITON_CACHE_DIR=/tmp/triton_cache -# DATA_DIR=/mnt/sharefs/users/hao.zhang/Vchitect-2M/Wan-Syn-upload/latents_i2v/train/ -DATA_DIR=/mnt/weka/home/hao.zhang/wei/FastVideo/data/crush-smol_processed_t2v/combined_parquet_dataset -# VALIDATION_DIR=/mnt/sharefs/users/hao.zhang/Vchitect-2M/mixkit/validation_8.json -VALIDATION_DIR=/mnt/weka/home/hao.zhang/wei/FastVideo/data/crush-smol-single_processed_t2v/validation.json -NUM_GPUS=8 -export FASTVIDEO_ATTENTION_BACKEND=FLASH_ATTN -# export FASTVIDEO_ATTENTION_BACKEND=FLASH_ATTN -# export CUDA_VISIBLE_DEVICES=4,5 -# IP=[MASTER NODE IP] -CHECKPOINT_PATH="outputs_train_test/wan_finetune/checkpoint-10" -# 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/training/wan_training_pipeline.py \ - --model_path Wan-AI/Wan2.2-T2V-A14B-Diffusers \ - --inference_mode False \ - --pretrained_model_name_or_path Wan-AI/Wan2.2-T2V-A14B-Diffusers \ - --cache_dir "/home/ray/.cache" \ - --data_path "$DATA_DIR" \ - --validation_dataset_file "$VALIDATION_DIR" \ - --train_batch_size 1 \ - --num_latent_t 16 \ - --sp_size 4 \ - --tp_size 1 \ - --num_gpus $NUM_GPUS \ - --hsdp_replicate_dim 1 \ - --hsdp-shard-dim 8 \ - --train_sp_batch_size 1 \ - --dataloader_num_workers 4 \ - --gradient_accumulation_steps 1 \ - --max_train_steps 30000 \ - --learning_rate 1e-5 \ - --mixed_precision "bf16" \ - --checkpointing_steps 1000 \ - --validation_steps 30 \ - --validation_sampling_steps "40" \ - --log_validation True \ - --checkpoints_total_limit 3 \ - --ema_start_step 0 \ - --training_cfg_rate 0.1 \ - --seed 1024 \ - --output_dir "outputs_train_test/wan_finetune_v1" \ - --tracker_project_name VSA_finetune \ - --num_height 448 \ - --num_width 832 \ - --num_frames 61 \ - --flow_shift 5 \ - --validation_guidance_scale "5.0" \ - --num_euler_timesteps 50 \ - --master_weight_type "fp32" \ - --dit_precision "fp32" \ - --weight_decay 0.01 \ - --max_grad_norm 1.0 \ No newline at end of file