# Repository Briefing: thu-ml/Causal-Forcing
> Source: https://repoforai.com/repo/thu-ml/Causal-Forcing (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/thu-ml/Causal-Forcing
- **Official Docs / Website**: https://thu-ml.github.io/CausalForcing.github.io/
- **Category**: Voice, Vision & Video (语音 / 视觉 / 视频生成)
- **Primary Language**: Python
- **License**: Apache-2.0
- **Engineering Health**: A (79/100 · Maintenance 35/35 · Adoption 13/25 · Releases 11/20 · License 20/20)
- **Review Snapshot**: 2026-12-03
- **Deployment / Stack Signals**: CLI, GPU
- **Momentum**: 1,042 ★ total (+0 24h / +5 7d) · 65 forks
- **Topics**: `auto-regressive-diffusion-model`, `autoregressive-models`, `consistency-models`, `diffusion`, `diffusion-models`, `distillation`, `few-step-generation`, `generative-ai`, `text-to-video`, `text-to-video-generation`, `video-diffusion-model`, `video-generation`
- **When to Use**: Best for: GPU-equipped research teams benchmarking short text- or image-conditioned video, comparing frame-wise and chunk-wise generation, or replacing ODE initialization with causal consistency distillation. Skip if: You need native minute-long generation from the base checkpoint, a production API with established latency and VRAM budgets, or a lightweight full-training workflow without distributed GPU setup.

## Overview
```text
### Architecture & Core Mechanics
Causal Forcing is a staged distillation codebase for causal autoregressive video diffusion, with frame-wise and chunk-wise generation. Stage 1 trains a multi-step autoregressive diffusion model. Stage 2 initializes a few-step generator with Causal ODE distillation or Causal Consistency Distillation (CD). Stage 3 applies asymmetric Distribution Matching Distillation (DMD) to produce the final generator. Intermediate checkpoints let researchers enter the pipeline at a later stage.

`train.py` runs YAML-configured jobs under `torchrun`, while `inference.py` pairs a configuration with a checkpoint and inputs. The source tree separates `trainer/`, `model/`, `pipeline/`, and `wan/`. The Python stack includes PyTorch ≥2.4.0, Diffusers 0.31.0, Transformers ≥4.49.0, and a separate `flash-attn` installation. The ODE route adds scripts that generate paired latents and prepare LMDB datasets; causal CD removes that preprocessing path.

### Key Capabilities & Differentiators
The GPU CLI supports text-to-video with chunk-wise or frame-wise checkpoints. The frame-wise path also supports image-to-video by using the conditioning image as the initial latent frame. The original frame-wise inference configuration uses four denoising steps; Causal Forcing++ publishes separate one- and two-step checkpoints with matching YAML files and `--use_ema` inference examples. The checkpoint setup includes Wan2.1-T2V-1.3B and Wan2.1-T2V-14B assets.

Base models are limited to 81 frames, roughly the five-second regime described for training. Minute-scale generation is a separate Rolling Forcing-based implementation under `long_video/`, not a longer output setting on the base checkpoints. Fewer denoising steps reduce that part of the workload, but do not establish end-to-end real-time throughput on a particular GPU.

### Trade-offs & Limitations
Self Forcing is the closest named comparison and shares the documented inference environment. Causal Forcing changes the initialization before DMD; its quality and motion gains should be checked on matched prompts and hardware rather than treated as deployment guarantees. Causal Forcing++ avoids generating ODE trajectories, and the original ODE route offers prepared data at about 300 GB. The CD route still needs ground-truth training data and a multi-step autoregressive model, whether trained locally or downloaded.

Reduced precision such as BF16 can destabilize CD or DMD for some models. If samples deteriorate or stay blurry, test FP32 and budget for its higher memory cost. The supplied batch-size-64 DMD recipe also cautions that training past about 1,000 steps may hurt motion, while smaller batches may benefit from longer runs. The code is Apache-2.0; assess the terms for weights and datasets separately.

### Hardware & Deployment Guide
The setup uses Python 3.10, the pinned and minimum-version requirements, OpenAI CLIP installed from Git, `flash-attn` installed with `--no-build-isolation`, and `python setup.py develop`. Validate that the GPU, PyTorch/CUDA stack, and FlashAttention build are compatible before provisioning the full environment. Download Wan assets and the matching checkpoint from Hugging Face, then run inference locally; the documented CLI path does not require a hosted inference API.

Use the released weights to validate inference before reserving a cluster for training. Full training examples use `torchrun` on eight nodes with eight processes per node and c10d rendezvous; this is an example scale, not a minimum. The supplied metadata lists no GitHub release. Checkpoints are distributed separately, and the ComfyUI node is maintained in a separate community repository.
```

## Key Capabilities
```text
- Training flow: Autoregressive diffusion training precedes causal initialization and asymmetric DMD.
- Data preparation: The Causal ODE path generates paired latents and packs them into LMDB; Causal Forcing++ skips ODE pair generation, not training data.
- Denoising schedules: The original frame-wise model has a 4-step CLI configuration, while Causal Forcing++ provides 1-step and 2-step checkpoints.
- Conditioning: The frame-wise generator supports image-to-video by taking the input image as its initial latent frame.
- Sequence length: Base generation is capped at 81 frames; minute-scale generation uses a separate Rolling Forcing extension under `long_video/`.
- Numerical stability: FP32 is the recommended fallback when reduced precision causes CD or DMD training to deteriorate.
```

## Quick Start / Clone
```bash
conda create -n causal_forcing python=3.10 -y
conda activate causal_forcing
pip install -r requirements.txt
pip install git+https://github.com/openai/CLIP.git
pip install flash-attn --no-build-isolation
python setup.py develop
```
