GitHub

ECCV 2026

arXiv Hugging Face Project webpage

Official implementation of UniTemp, a few-step video diffusion model distilled from Wan2.1 that generates videos in any temporal order with a single set of weights:

1. Environment setup

git clone https://github.com/lzhangbj/UniTemp.git
cd UniTemp
conda create -n unitemp python=3.10 -y
conda activate unitemp
pip install --no-build-isolation -r requirements.txt
pip install ninja
MAX_JOBS=32 pip install flash-attn --no-build-isolation --no-cache-dir
python setup.py develop

2. Download pretrained checkpoints

All UniTemp checkpoints are hosted at Linz99/UniTemp. Inference also needs the Wan2.1-T2V-1.3B base model (VAE, text encoder, and model config):

# UniTemp checkpoints -> ./checkpoints/
huggingface-cli download Linz99/UniTemp --include "checkpoints/*" --local-dir .
# Wan2.1 base model -> ./wan_models/Wan2.1-T2V-1.3B
huggingface-cli download Wan-AI/Wan2.1-T2V-1.3B --local-dir wan_models/Wan2.1-T2V-1.3B

The released model used by all inference scripts is checkpoints/unified_dmd-large-blockwise/checkpoint_model_000600/model.pt.

3. Inference

All three modes share the same checkpoint, run on a single GPU, and write 480×832 / 16 FPS .mp4 videos to outputs/:

# Forward: past -> future
bash scripts/inference_forward.sh
# Backward: future -> past
bash scripts/inference_backward.sh
# In-between: head clip + tail clip, then interpolate the transition
bash scripts/inference_inbetween.sh

Extra arguments are forwarded to the underlying Python module, e.g.:

bash scripts/inference_forward.sh --data_path my_prompts.json --num_output_frames 21 --num_samples 4
  • --data_path (forward/backward): a JSON list of prompt strings — see prompts/MovieGenVideoBench_extended_128.json.
  • --caption_path (in-between): a JSON list of [head_prompt, tail_prompt] pairs — see prompts/inbetween.json.
  • --num_output_frames: video length in latent frames (pixel frames = 1 + 4×(n−1); default 84 ≈ 21 s).
  • For multi-GPU inference, replace python with torchrun --nproc_per_node=8 inside the script; prompts are sharded across ranks.

4. Training

Training is two-stage. Scripts default to 8 node × 8 GPUs; override with NNODES / NPROC_PER_NODE. Logs and checkpoints go to logs/<exp_name>/, and runs auto-resume from there. Pass --disable-wandb to skip W&B logging (or set wandb_key / wandb_entity in configs/default_config.yaml).

4.0 Prepare teachers

# Wan2.1 base + teacher models -> ./wan_models/
huggingface-cli download Wan-AI/Wan2.1-T2V-1.3B --local-dir wan_models/Wan2.1-T2V-1.3B
huggingface-cli download Wan-AI/Wan2.1-T2V-14B  --local-dir wan_models/Wan2.1-T2V-14B

4.1 Stage 1 — ODE initialization

# ODE pair dataset (LMDB, generated with Wan2.1-T2V-14B) -> ./datasets/
huggingface-cli download Linz99/UniTemp --include "datasets/*" --local-dir .
bash scripts/train_ode.sh   # configs/unified_ode-large-blockwise.yaml

4.2 Stage 2 — Self-Forcing distillation

Download the stage-2 text prompts (too large for GitHub) to prompts/vidprom_filtered_extended.txt:

huggingface-cli download Linz99/UniTemp --include "prompts/*" --local-dir .
bash scripts/train_dmd.sh   # configs/unified_dmd-large-blockwise.yaml

5. Acknowledgements

This codebase builds on CausVid, Self-Forcing, and Wan2.1. We thank the authors for open-sourcing their work.

6. Citation

@article{zhang2026unitemp,
  title={UniTemp: Unlocking Video Generation in Any Temporal Order via Bidirectional Distillation},
  author={Zhang, Lin and Mo, Sicheng and Cai, Zefan and Lin, Jinhong and Lin, Zihao and Gu, Jiuxiang and Singh, Krishna Kumar and Li, Yuheng and Li, Yin},
  journal={arXiv preprint arXiv:2606.18702},
  year={2026}
}

Read the original on github.com ↗