ComfyUI-TeaCache
Run ComfyUI Easily with InstaSD
Skip the complex setup. InstaSD helps creative professionals build workflows and deploy them to the world:
- One-click deployment
- Any model, any node
- Powerful GPUs for rapid iteration
Available Nodes
TeaCache
ComfyUI TeaCache Node Documentation
Overview
The TeaCache node is a component of the ComfyUI ecosystem that leverages the Timestep Embedding Aware Cache (TeaCache) technology, a training-free caching approach designed to estimate and utilize the fluctuating differences among model outputs across timesteps. By doing so, it accelerates the inference process in various types of diffusion models, including image, video, and audio models. This node provides seamless integration with the native nodes of ComfyUI.
Functionality
What the TeaCache Node Does
The TeaCache node applies the TeaCache mechanism to a specified diffusion model within a ComfyUI workflow. This mechanism enables faster inference by caching and optimizing model outputs dynamically, which results in reduced computation times while maintaining acceptable levels of visual quality.
Node Inputs
The TeaCache node requires the following inputs:
-
Model: The diffusion model to which TeaCache will be applied. It is selected from the models available within ComfyUI.
-
Model Type: A selection from a list of supported diffusion models (e.g.,
flux,flux-kontext,ltxv,lumina_2,hunyuan_video, etc.). This determines the specific method of applying the TeaCache within the node. -
rel_l1_thresh: A floating-point value indicating the threshold for how strongly the output of the diffusion model is cached. This value influences the trade-off between caching efficiency and output quality.
-
start_percent: A floating-point value (between 0 and 1) determining the start percentage of model steps where TeaCache begins its operation.
-
end_percent: A floating-point value (between 0 and 1) that sets the end percentage of model steps where TeaCache continues its operation.
-
cache_device: Specifies the device where the cache will reside. Options include
cudafor GPU caching (faster inference) andcpufor CPU caching (uses less VRAM).
Node Outputs
The output of the TeaCache node is a modified version of the input model that incorporates the TeaCache framework. This enhanced model can now perform faster inference within the ComfyUI workflow while maintaining the same output specifications.
Usage in ComfyUI Workflows
To use the TeaCache node in a ComfyUI workflow:
-
Add the TeaCache Node: Insert the TeaCache node into your workflow following a Load Diffusion Model node or any specialized model-loading node like Load LoRA if applicable.
-
Connect and Configure: Set up the TeaCache node by connecting it with your model node and configuring its parameters (model type, caching thresholds, etc.) as discussed in the inputs section.
-
Optimize Your Model: The model post-configuration can be integrated with downstream processing nodes to generate outputs more efficiently, benefiting from the applied caching mechanism.
Special Features and Considerations
-
Speedup Advantage: TeaCache aims to provide a speedup of up to 3x depending on model and parameters, with minimal loss in quality.
-
Device Optimization: Users with adequate VRAM should prefer the
cudaoption for improved performance. Thecpuoption remains available for lower VRAM contexts. -
Parameter Sensitivity: Adjusting
rel_l1_thresh,start_percent, andend_percentrequires careful consideration. While the configuration examples are provided for various models in the original documentation, fine-tuning these parameters may be necessary for specific workflows or quality requirements. -
Integration with Other Nodes: TeaCache is compatible with other native ComfyUI nodes and can be used in conjunction with nodes like Compile Model for additional performance enhancements.
This node enhances workflow efficiency in ComfyUI projects that involve diffusion model inferences by providing a smart caching mechanism, making it a valuable tool for developers seeking to optimize computational resources and speed up their rendering processes.