🌀 Self Gradient Forcing
Native Long-Video Extrapolation
Junhao Zhuang, Shiyi Zhang, Yuxuan Bian, Yaowei Li, Yawen Luo, Yijun Liu, Weiyang Jin, Songchun Zhang, Xianglong He, Xuying Zhang, Haoran Li, Haoyang Huang, Zeyue Xue, Nan Duan
Joy Future Academy, JD
⭐ If Self Gradient Forcing is useful for your research, please consider starring this repository.
🔥 News
- 2026-07-23: Paper, model checkpoints, inference scripts, and training code are publicly released.
🧠 Method Overview
Self Gradient Forcing (SGF) recovers the missing context-gradient path for self-generated causal memory through a bounded two-pass replay, enabling models trained with only a 5-second window to extrapolate to minute-scale videos with stronger identity, layout, and temporal stability.
🛠️ Installation
The environment follows the Causal-Forcing setup.
conda create -n self_gradient_forcing python=3.10 -y
conda activate self_gradient_forcing
pip install -r requirements.txt
pip install flash-attn --no-build-isolation
python setup.py develop
⬇️ Download Weights
bash scripts/download_weights.sh
The script uses the Hugging Face CLI command hf by default. Set HF_CLI=huggingface-cli if your environment still uses the older command name.
It downloads:
- Wan base models to
wan_models/Wan2.1-T2V-1.3B and wan_models/Wan2.1-T2V-14B.
- All Causal-Forcing initialization checkpoints under
checkpoints/init/framewise/ and checkpoints/init/chunkwise/: ar_diffusion.pt, causal_cd.pt, and causal_ode.pt.
- Released SGF inference checkpoints to
checkpoints/framewise/ar/model.pt and checkpoints/chunkwise/ar/model.pt.
- The training prompt list to
prompts/vidprom_filtered_extended.txt.
🚀 Inference
The default prompt file is prompts/test_prompt.txt with 8 prompts. The launcher uses 8 GPUs when at least 8 GPUs are visible; otherwise it falls back to single-GPU serial inference. By default it generates 963 latent frames, which decode to about 240 seconds of video at 16 fps.
The inference script takes the release setting name (framewise or chunkwise) and selects the matching config and checkpoint automatically:
- framewise config:
configs/self_gradient_forcing_framewise.yaml
- chunkwise config: `configs/self_gradie