ComfyUI Node

OpenDiT Sampler

The sampler where OpenSora actually makes the video

By kijai·Created 2 years ago·Updated 2 years ago· 43
OpenDiT Sampler
  • opendit_model
  • opendit_vae
  • opendit_cond
  • samples
  • opendit_vae
num_frames24
width426
height240
seed0
steps25
cfg7.00
fps24
keep_model_loadedfalse

This is the payoff node - the one that actually generates the video. It takes your loaded model, VAE and conditioning and runs the diffusion loop that turns a ball of noise into a five-dimensional latent you can decode into frames. Everything before it is setup; everything after it is cleanup.

How it works

The sampler runs the same rectified-flow (RFLOW) scheduling family that SD3 and Flux popularized - OpenDiT uses use_timestep_transform=True with the OpenSora timestep transform, and a CFG scale applied on top of the null-text embedding. It builds a random latent shaped (1, 4, T, H, W) using the VAE's get_latent_size (that's why the VAE is an input), seeds torch.manual_seed from your seed, and then embeds the resolution, frame count, aspect ratio and fps as extra conditioning tokens - OpenSora is resolution-adaptive, so changing width/height/fps actually changes the output, not just the canvas.

There's a speed trick you should know about, because it's on by default and invisible: Pyramid Attention Broadcast (PAB). The wrapper configures the PAB manager with cross, spatial and temporal attention broadcast - reusing attention maps between nearby steps instead of recomputing them. That's the same technique OpenSora uses to hit big speedups, and this wrapper just enables it for you. You can't toggle it from the UI, but it's worth knowing it's there when you're comparing timings.

Inputs that matter

  • opendit_model / opendit_vae / opendit_cond - the three feeds: model from the model loader, VAE from the VAE loader, conditioning from OpenDiTConditioning.
  • num_frames - default 24, up to 200. This is the length knob. 48 frames at 24fps is two seconds.
  • width / height - defaults 426x240, and yes, that's tiny on purpose. Video VRAM scales brutally with resolution; the README says 48 frames at 768x512 fits in 15GB, and less frames or smaller res fits in 10GB. Start small, then climb.
  • steps - 25 default. OpenSora v3 handles lower step counts reasonably, but 25–30 is the safe zone.
  • cfg - 7 default, 0–20. Higher = prompt adherence at the cost of weirdness and speed. The model was tuned around 7.
  • fps - 24 default. As noted, it's embedded as conditioning, so it genuinely changes motion character.
  • seed - 0 to a 64-bit max, standard.
  • keep_model_loaded - leave off; when on, the diffusion model stays on the GPU between runs for faster iteration at the cost of VRAM.

Outputs

  • samples (LATENT) - the video latent. Don't feed this to the stock VAE Decode; it can't handle the temporal dimension. It goes to OpenSoraDecode.
  • opendit_vae - the VAE passed through, so you can wire OpenSoraDecode straight off the sampler without re-loading the VAE node. Small but convenient.

Installing

ComfyUI Manager → "ComfyUI-OpenDiTWrapper", or:

cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-OpenDiTWrapper
pip install -r requirements.txt
pip install xformers --no-deps

Restart afterward. Windows portable: run pip via python_embeded\python.exe.

Common issues

Most sampler problems here are VRAM, and the fix is always the same order of operations: drop frames first, then resolution, then step count. If you get an OOM, don't touch cfg - it doesn't meaningfully change memory. And if the run is much slower than you expected, check the terminal for the "flash attention is not available" warning at startup; that means your attention fallback is the slow path and the xformers install step got skipped.

CategoryOpenDiTWrapper

Inputs (11)

NameTypeDefaultDescription
opendit_modelOPENDITMODEL
opendit_vaeVAE
opendit_condOPENDITCOND
num_framesINT241–200
widthINT4261–2048
heightINT2401–2048
seedINT00–18446744073709550000
stepsINT251–200
cfgFLOAT7.000–20
fpsINT241–60
keep_model_loadedBOOLEANfalse

Outputs (2)

NameTypeDescription
samplesLATENT
opendit_vaeVAE