Skip to content

Commit cd1ed6a

Browse files
pthombreclaude
andcommitted
feat: add HunyuanVideo nightly CI test and parameterize diffusion launcher
Add HunyuanVideo-1.5 to the diffusion finetuning CI pipeline alongside Wan2.1. Parameterize the launcher script to derive model-specific settings (processor, generate config, model name, frame counts) from the recipe config name. Also fix a pre-existing T5 layer norm compatibility issue in finetune.py that affects Hunyuan training with incompatible apex builds. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d00b6e1 commit cd1ed6a

4 files changed

Lines changed: 39 additions & 5 deletions

File tree

examples/diffusion/finetune/finetune.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616

1717
from nemo_automodel.components.config._arg_parser import parse_args_and_load_config
1818
from nemo_automodel.recipes.diffusion.train import TrainDiffusionRecipe
19+
from nemo_automodel.shared.transformers_patches import patch_t5_layer_norm
1920

2021

2122
def main(default_config_path="examples/diffusion/finetune/wan2_1_t2v_flow.yaml"):
23+
patch_t5_layer_norm()
2224
cfg = parse_args_and_load_config(default_config_path)
2325
recipe = TrainDiffusionRecipe(cfg)
2426
recipe.setup()

examples/diffusion/finetune/hunyuan_t2v_flow.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,7 @@ dist_env:
8282
init_method: "env://"
8383

8484
seed: 42
85+
86+
ci:
87+
recipe_owner: pthombre
88+
time: "01:30:00"

tests/ci_tests/configs/diffusion_finetune/nightly_recipes.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@
1515
examples_dir: diffusion/finetune
1616
configs:
1717
- wan2_1_t2v_flow.yaml
18+
- hunyuan_t2v_flow.yaml

tests/ci_tests/scripts/diffusion_finetune_launcher.sh

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,32 @@ INFER_DIR="$PIPELINE_DIR/$TEST_NAME/inference_output"
2424

2525
cd /opt/Automodel
2626

27+
# ============================================
28+
# Derive model-specific settings from config
29+
# ============================================
30+
RECIPE_NAME=$(basename "$CONFIG_PATH" .yaml)
31+
case "$RECIPE_NAME" in
32+
wan2_1_t2v_flow*)
33+
PROCESSOR="wan"
34+
GENERATE_CONFIG="examples/diffusion/generate/configs/generate_wan.yaml"
35+
MODEL_NAME="Wan-AI/Wan2.1-T2V-1.3B-Diffusers"
36+
INFER_NUM_FRAMES=9
37+
PREPROCESS_EXTRA_ARGS=""
38+
;;
39+
hunyuan_t2v_flow*)
40+
PROCESSOR="hunyuan"
41+
GENERATE_CONFIG="examples/diffusion/generate/configs/generate_hunyuan.yaml"
42+
MODEL_NAME="hunyuanvideo-community/HunyuanVideo-1.5-Diffusers-720p_t2v"
43+
INFER_NUM_FRAMES=5
44+
PREPROCESS_EXTRA_ARGS="--target_frames 13"
45+
;;
46+
*)
47+
echo "ERROR: Unknown recipe '$RECIPE_NAME'. Add a case to diffusion_finetune_launcher.sh."
48+
exit 1
49+
;;
50+
esac
51+
echo "[config] Recipe=$RECIPE_NAME Processor=$PROCESSOR Model=$MODEL_NAME"
52+
2753
# ============================================
2854
# Stage 1: Download dissolve dataset
2955
# ============================================
@@ -45,9 +71,10 @@ echo "============================================"
4571
uv run --extra diffusion python -m tools.diffusion.preprocessing_multiprocess video \
4672
--video_dir "$DATA_DIR/raw" \
4773
--output_dir "$DATA_DIR/cache" \
48-
--processor wan \
74+
--processor "$PROCESSOR" \
4975
--resolution_preset 512p \
50-
--caption_format sidecar
76+
--caption_format sidecar \
77+
$PREPROCESS_EXTRA_ARGS
5178

5279
# ============================================
5380
# Stage 3: Finetune
@@ -81,11 +108,11 @@ echo "============================================"
81108
CKPT_STEP_DIR=$(ls -d $CKPT_DIR/epoch_*_step_* | sort -t_ -k4 -n | tail -1)
82109

83110
uv run --extra diffusion python examples/diffusion/generate/generate.py \
84-
--config examples/diffusion/generate/configs/generate_wan.yaml \
85-
--model.pretrained_model_name_or_path Wan-AI/Wan2.1-T2V-1.3B-Diffusers \
111+
--config "$GENERATE_CONFIG" \
112+
--model.pretrained_model_name_or_path "$MODEL_NAME" \
86113
--model.checkpoint "$CKPT_STEP_DIR" \
87114
--inference.num_inference_steps 5 \
88-
--inference.pipeline_kwargs.num_frames 9 \
115+
--inference.pipeline_kwargs.num_frames "$INFER_NUM_FRAMES" \
89116
--output.output_dir "$INFER_DIR" \
90117
--vae.enable_slicing true \
91118
--vae.enable_tiling true

0 commit comments

Comments
 (0)