referenced from https://github.com/ali-vilab/TeaCache/tree/main/TeaCache4Lumina2
firstly transplanted by @fexli
// switch to your project's root directory
cd custom_nodes
git clone https://github.com/spawner1145/CUI-Lumina2-TeaCache.git- Open ComfyUI WebUI
- Navigate to
Manager->Install Custom Node - Enter
CUI-Lumina2-TeaCachein theSearchfield, and clickSearch - Click
Install
- Connect the
TeaCachenode between theUNet LoaderandKSamplerin your workflow. - Set the
rel_l1_threshparameter to a value greater than 0. - to work on low steps, you can set the value below to
[393.76566581, -603.50993606, 209.10239044, -23.00726601, 0.86377344]and a smallrel_l1_threshlike 0.3 for higher speed or set the value below to[225.7042019806413, -608.8453716535591, 304.1869942338369, 124.21267720116742, -1.4089066892956552]and a very largerel_l1_threshlike 5 for higher speed and better quality, and for higher steps, you can set the value below to[225.7042019806413, -608.8453716535591, 304.1869942338369, 124.21267720116742, -1.4089066892956552]and arel_l1_thresh<1.1 to get better quality and higher speed. - The nodes are configured with different parameters. When using 25 steps or fewer, it is recommended to set the l1 value to approximately 6. For larger step sizes, the l1 should be decreased proportionally. For instance, a value of 0.6 is suggested for 50 steps.(
[225.7042019806413, -608.8453716535591, 304.1869942338369, 124.21267720116742, -1.4089066892956552])
Note:
- Higher
rel_l1_threshvalues will improve generation efficiency (manifested as shorter generation times), at the cost of reduced image quality. - The optimal value should be determined through empirical testing based on your specific quality/efficiency requirements.
TeaCache can speedup Lumina-Image-2.0 without much visual quality degradation, in a training-free manner. The following image shows the results generated by TeaCache-Lumina-Image-2.0 with various rel_l1_thresh values: 0 (original), 0.2 (1.25x speedup), 0.3 (1.5625x speedup), 0.4 (2.0833x speedup), 0.5 (2.5x speedup).
| Lumina-Image-2.0 | TeaCache (0.2) | TeaCache (0.3) | TeaCache (0.4) | TeaCache (0.5) |
|---|---|---|---|---|
| ~25 s | ~20 s | ~16 s | ~12 s | ~10 s |
The original TeaCache transplant of Lumina2 in cui
model patch code design





