Comfy-Org / Comfy-Org/ComfyUI

Add `Remove Hooks From Cond` Node

Open
#6,471 0 comments 9 reactions 0 assignees View on GitHub
Feature
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 6h
Merged PRs (30d)
155

Description

### Feature Idea

A node that takes in positive and negative conditioning as input and outputs both with all attached hooks removed.

The Lora is often no longer necessary after the first pass but it seems to contribute to a large VRAM usage spike when trying to do 2nd pass after upscaling.

### Existing Solutions

This can be currently avoided by creating 2 sets of conditioning differing in the presence of Lora hooks and feeding the one with hooks into the first pass KSampler and the other for everything afterwards. This approach works but requires a lot of additional nodes and leads to a lot of clutter when a single node simply removing the hooks could replace all of it.

This is with hook present for the entire workflow:
![image](https://github.com/user-attachments/assets/0f9a0357-e671-44da-8a9e-c0de01e72679)
Vram usage reaches 100% (RTX 3090 24GB) on second cycle of iterative upscaling, resolution 1280.0x1920.0.

And this is with hook present only for the first pass (the first sampling of 16 steps):
![image](https://github.com/user-attachments/assets/be8555a7-e872-4149-95d5-9f572f125fe5)
Vram usage tops off at 57%.

### Other

Here is my workflow configured to use 2 separate conditioning sets with and without lora. You can replace the `basic_pipe` input in iterative upscale with the `basic_pipe` from `1st pass` to see the result of keeping the hooks. The nodes coloured red are used to create the secondary conditioning set without lora hooks and could be replaced with the proposed node. This workflow uses `ImpactPack`, `InspirePack`, `WAS's node suite` and Pythongosssss's `Custom Scripts` node packs, but they are not necessary for implementing the described solution.
[RegionLoraTest.json](https://github.com/user-attachments/files/18416345/RegionLoraTest.json)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.