Nodes/ComfyUI_Patches_ll/DitForwardOverrider
ComfyUI Node Runs on cloud

DitForwardOverrider

One overrider to rule Flux and every video model

By lldacing·Created 2 years ago·Updated 8 months ago· 124
DitForwardOverrider
  • model
  • model

If you install only one node from this pack, this is the one. DitForwardOverrider is the auto-detecting version of the overrider nodes: it looks at whatever diffusion model you feed it and installs the right forward-pass hooks - the Flux wrapper if it's Flux, the video wrapper if it's HunYuanVideo, LTXVideo, MochiVideo, or WanVideo. It's a model-in, model-out pass-through with no settings, and by itself it changes nothing. Its whole job is to make ApplyTeaCachePatch and ApplyFirstBlockCachePatch actually work.

The pack ships two scoped overriders (FluxForwardOverrider for Flux, VideoForwardOverrider for video), but you don't need to remember which is which if you use this one. That's the appeal: you can swap a Flux checkpoint for a Wan video model in the same graph and the caching chain keeps working without touching the wiring. It's the "just works" option and the one the pack's author points you toward for automatic model-type detection.

How it works

At sampling start, it swaps in a rewritten forward_orig (or forward, for models that only expose that) that reads a patches_point table from the model options. The cache patch nodes register their hook functions into that table. So the chain is:

UNETLoader → ApplyTeaCachePatch → DitForwardOverrider → BasicGuider → KSampler

The overrider restores the original forward when sampling ends, so nothing leaks into other parts of the workflow. On an unsupported model it does nothing rather than crashing - you can't break a graph with it.

Install

Part of ComfyUI_Patches_ll, found in ComfyUI Manager by that name, or:

cd ComfyUI/custom_nodes
git clone https://github.com/lldacing/ComfyUI_Patches_ll.git
# restart ComfyUI

Requires ComfyUI ≥ 0.3.17. No models, no dependencies beyond numpy/packaging.

When to use the scoped ones instead

Rarely. FluxForwardOverrider is marginally cheaper for a Flux-only setup and is what the pack's example workflow uses, and VideoForwardOverrider is the video equivalent. But both are just DitForwardOverrider with the type check pre-decided, so unless you're shaving milliseconds of model-check overhead, the auto-detect version is the sensible default - especially since these caching nodes only speed things up when the model type matches, and it's easy to misremember which overrider pairs with which cache node.

Categorypatches/dit

Inputs (1)

NameTypeDefaultDescription
modelMODEL

Outputs (1)

NameTypeDescription
modelMODEL