Fixed comfyui_patches_ll to newest ComfyUI
ParaAttentionNode Fix Summary (Detailed Version)
1. Error That Occurred
Affected Node: `KSamplerAdvanced` (when using MultiGPU patch internally)
Stack Trace Origin
When `WrapperExecutor.execute()` calls `fb_cache_prepare_wrapper` via CFG guidance processing in `comfy/samplers.py`, the keyword argument `latent_shapes` is passed
`fb_cache_prepare_wrapper` retains the old function signature and does not expect `latent_shapes`, causing a TypeError and stopping execution
2. Root Cause Analysis
ComfyUI Core Specification Change
`WrapperExecutor.execute()` now passes new keywords like `latent_shapes` to CFG wrappers
comfyui_patches_ll Wrapper Has Outdated Signature
`fb_cache_prepare_wrapper(wrapper_executor, noise, latent_image, sampler, sigmas, denoise_mask=None, callback=None, disable_pbar=False, seed=None)` stops at this definition and rejects new keywords
Result
When running KSampler on models with First Block Cache (FBC) applied, a TypeError halts execution
Specifically, the FBC wrapper in ParaAttentionNode (`comfyui_patches_ll`) is the culprit
3. Fix Implementation
File Modified: `ComfyUI/custom_nodes/comfyui_patches_ll/nodes/ParaAttentionNode.py`
Function Modified: `fb_cache_prepare_wrapper`
def fb_cache_prepare_wrapper(wrapper_executor, noise, latent_image, sampler, sigmas,
denoise_mask=None, callback=None, disable_pbar=False,
seed=None, latent_shapes=None, **kwargs):
cfg_guider = wrapper_executor.class_obj
try:
out = wrapper_executor(
noise,
latent_image,
sampler,
sigmas,
denoise_mask=denoise_mask,
callback=callback,
disable_pbar=disable_pbar,
seed=seed,
latent_shapes=latent_shapes,
**kwargs
)
finally:
diffusion_model = cfg_guider.model_patcher.model.diffusion_model
if hasattr(diffusion_model, fb_cache_model_temp):
delattr(diffusion_model, fb_cache_model_temp)
return outKey Changes
Extended Function Signature
Now accepts the new keyword argument `latent_shapes`, and additionally captures `**kwargs` for future extensibility
Pass Through to Lower Layer
During wrapper execution, forward received arguments as `wrapper_executor(..., latent_shapes=latent_shapes, **kwargs)` to downstream handlers
Existing Cleanup Logic Unchanged
The `finally:` block that clears temporary attributes from the diffusion model remains unmodified, so no side effects occur
4. Results Achieved
TypeError Resolved
When `latent_shapes` and other additional arguments are passed, the wrapper can now handle them, allowing KSampler to complete successfullyBackward Compatibility Maintained
Existing FBC operations (cache registration and cleanup) work as before
No impact on other wrappers or MultiGPU nodes
Future-Proof
Because `**kwargs` is captured, even if more parameters are added in the future, TypeError will not occur
5. Supplementary Notes
The problem originated from parameter additions accompanying ComfyUI core updates
If ParaAttentionNode is not updated, a TypeError will halt execution as seen here
`latent_shapes` is a parameter added when samplers like DPM++ handle multiple latents; this fix ensures the wrapper adapts to that change
Above is the detailed explanation of the ParaAttentionNode (First Block Cache wrapper) fix and its implementation.
