Nodes/ControlFoley Official/ControlFoley Torch Compile
ComfyUI Node

ControlFoley Torch Compile

The optional speed button

By YJX-Research·Created 2 months ago·Updated 2 months ago· 6
ControlFoley Torch Compile
  • controlfoley_model
  • controlfoley_model
  • status
compile_encoderstrue
compile_generatorfalse

ControlFoley Torch Compile is the pack's optional speed knob. It takes a loaded controlfoley_model, runs PyTorch's JIT compiler over the pieces you ask for, and hands back the same model object plus a status string. Nothing about the model's architecture changes - you're paying a one-time compile latency to make the encoder passes (and optionally the generator) run faster on subsequent inference. If you're running the same workflow repeatedly, it can be genuinely worthwhile; if you're just trying to hear your first foley clip, it's pure friction.

The two switches

  • compile_encoders (default true) - compiles the feature encoders via the runtime's own compile path. This is the safe, usually-worth-it one: encoders get called a lot per video frame.
  • compile_generator (default false) - wraps the whole generator network in torch.compile. More upside, more risk: generator compilation is the kind of thing that can blow up on edge cases mid-workflow, and the source wraps it in a try/except that downgrades a failure to a status message rather than killing the run.

The Triton gate you should know about

Here's the design detail that'll save you a confusing half-hour: torch.compile on CUDA needs a working Triton, and the failure mode of "no Triton" is a deferred crash inside the first compiled call - which would poison the shared cached model for every later workflow. So this node checks up front (has_triton()), and if Triton isn't there it skips compilation and returns a status like "torch.compile skipped: no working Triton on this platform". That's not a bug; it's the node refusing to hand you a time bomb. If you see that string, install Triton (or a torch build that ships it) rather than fighting the node.

Inputs and outputs

Inputs: controlfoley_model (from the Model Loader) plus the two booleans. Outputs: controlfoley_model again (chain it onward into a Generate node - think of this node as a filter the model passes through) and status (STRING, e.g. "feature encoders compiled; generator compiled" or "nothing to compile").

When to bother

The bundled workflows ship with compilation off (compile_encoders=false), and the README explicitly says to leave it off for first-run smoke tests because of the one-time latency cost. Once you've confirmed a clean generation, flip this node into the chain between Model Loader and Generate, enable compile_encoders, and let it bake. Leave compile_generator off unless you're chasing every last second and are prepared to read the status string when it decides not to cooperate.

Install the pack via ComfyUI Manager ("ControlFoley Official") or git clone into custom_nodes + pip install -r requirements.txt (install only genuinely-missing packages one at a time - the requirements file holds version ranges that can bump shared deps). CUDA-only, like everything here.

CategoryControlFoley

Inputs (3)

NameTypeDefaultDescription
controlfoley_modelCONTROLFOLEY_MODEL
compile_encodersBOOLEANtrue
compile_generatorBOOLEANfalse

Outputs (2)

NameTypeDescription
controlfoley_modelCONTROLFOLEY_MODEL
statusSTRING