cubiq / ComfyUI_IPAdapter_plus

GNU General Public License v3.0
3.14k stars 237 forks source link

Can I run IPAdapter sequentially on multiple KSampler passes? #516

Open sdk401 opened 2 months ago

sdk401 commented 2 months ago

I have simple workflow in which I split image in tiles, rebatch them so I have them not as one batch, but as separate images, encode them and run them through KSampler. It runs ok, KSampler is denoising the images one after another, sequentially.

Now I need to add IPadapter to guide the denoise better. I pass the same rebatched images to IPAdapter node, and it looks like it is loading all of them at the same time. So when there is more than 10-12 tiles I get a memory error, and even if I get past the IPAdapter node, KSampler works very slow after that - like, 2 mins for one tile instead of 6-8 seconds (I'm using lightning model with 4 steps).

So my question is, is there a way to make IPAdapter node load the images one by one, as KSampler does? I'm not very good at understanding how comfyui works inside, so I'm not sure if this is possible at all.

I'm attaching the workflow just in case. There is just one custom tiling node, all other nodes are base comfy + ipadapter. The same behaviour can be replicated without tiling, by just loading and batching/rebatching multiple images.

tiled denoise.json