Files
hao-ai-lab-FastVideo/examples/train
Will Lin f96b8e2ad2 [feat] Add LTX-2 standard diffusion fine-tuning to modular trainer
Add LTX2Model plugin to fastvideo/train (FineTuneMethod-compatible),
matching the official Lightricks LTX-2 trainer semantics:
- stretched shifted-logit-normal sigma sampling with token-count-
  dependent shift (0.95@1024 -> 2.05@4096 tokens) and 10% uniform mix
- per-token sigma timesteps; DiT x0 output converted to velocity so
  the default noise-minus-clean MSE target applies
- fps-carrying forward context so training RoPE matches validation
- activation checkpointing applied to the nested transformer.model
- audio/cross-modal params (5.8B) frozen by default for video-only FT

Also add a standalone overfit preprocess script (LTX-2 VAE latents +
post-connector Gemma embeddings -> t2v parquet), a 4-GPU overfit
config, single-step GPU smoke tests with a seeded GB200 grad-norm
reference, and a nightly e2e overfit test on the single-cat sample.

Verified on 4x GB200 (FSDP full shard, sp_size=1): 300 steps, train
loss 0.51 -> 0.012, validation mean MS-SSIM vs the training clip
0.15 (step 0) -> 0.96 (step 300); e2e test passes.
2026-07-18 14:51:51 -07:00
..

Training

Quick Start

Single-node

bash examples/train/run.sh <config.yaml> [--dotted.key value ...]

The script auto-detects available GPUs. Override with NUM_GPUS:

NUM_GPUS=4 bash examples/train/run.sh \
    examples/train/configs/fine_tuning/wan/t2v.yaml

Multi-node (Slurm)

bash examples/train/run_slurm.sh <config.yaml> <num_nodes> [--dotted.key value ...]
bash examples/train/run_slurm.sh \
    examples/train/configs/fine_tuning/wan/t2v.yaml 4 \
    --training.distributed.hsdp_shard_dim 8 \
    --training.distributed.hsdp_replicate_dim 4

Slurm environment variables:

Variable Default Description
PARTITION main Slurm partition
NUM_GPUS 8 GPUs per node
CPUS_PER_TASK 128 CPUs per task
MEM 1440G Memory per node
EXCLUDE "" Nodes to exclude

Overriding config values

Any config field can be overridden from the command line using dotted keys:

bash examples/train/run.sh examples/train/configs/fine_tuning/wan/t2v.yaml \
    --training.optimizer.learning_rate 1e-5 \
    --training.loop.max_train_steps 1000 \
    --training.checkpoint.output_dir outputs/my_experiment

Resuming from a checkpoint

bash examples/train/run.sh examples/train/configs/fine_tuning/wan/t2v.yaml \
    --training.checkpoint.resume_from_checkpoint outputs/my_experiment/checkpoint-500

W&B Logging

Training metrics and validation videos are logged to Weights & Biases. Set your API key before launching:

export WANDB_API_KEY=your_key_here

To disable W&B (e.g. for local debugging):

export WANDB_MODE=offline

The project name and run name are set in the config under training.tracker:

training:
  tracker:
    project_name: my_project
    run_name: my_run

Directory Layout

examples/train/
├── configs/      # Single-step training configs (by method and model)
├── scenario/     # Multi-step end-to-end training pipelines
├── run.sh        # Single-node launcher
└── run_slurm.sh  # Multi-node Slurm launcher

See configs/README.md and scenario/README.md for details.