Open MoonMoon82 opened 11 months ago
maybe fixed it https://github.com/laksjdjf/IPAdapter-ComfyUI/pull/36
Hi this didn't fix it, still has the same problem
Is the resolution of the mask the same as the image?
@laksjdjf I think when I do the print outs, the problem is that mask.shape[0] and mask.shape[1] are both 1's, so the mask_size = 1 and the downsample rate becomes 0. Here is what I have:
DOWNSAMPLE RATE 0 MASK SHAPE torch.Size([1, 1, 1023, 1023]) IP OUT SHAPE torch.Size([2, 16129, 320]) inpaint_ipadapter.json
Note that the mask works perfectly fine with the inpainting controlnet. The IPAdapter also works well when the mask isn't included. The problem occurs when the mask is added into the IPAdapter.
Where did you insert the print statement?
Is it above this? https://github.com/laksjdjf/IPAdapter-ComfyUI/blob/1127a2dc95d9df646bc7fdf458bdb57d671d7118/ip_adapter.py#L300
Yeah. The division by 0 comes from the down_sample_rate = 0, which comes from mask_size = 1 since mask.shape[0] = 1 and mask.shape[1] = 1, so when you do
down_sample_rate = int((mask_size // 64 // out.shape[1]) ** (1/2)) you're dividing by 0.
I can confirm, the issue I was initially refering to was fixed. But the error message still appears if I try to do a second (hires) cycle, because the mask resolution does not match to the latent resolution anymore. It would be aweseome if this could be solved by automatically stretch scaling the mask to the latent image resolution! (?)
@laksjdjf I think when I do the print outs, the problem is that mask.shape[0] and mask.shape[1] are both 1's, so the mask_size = 1 and the downsample rate becomes 0. Here is what I have:
DOWNSAMPLE RATE 0 MASK SHAPE torch.Size([1, 1, 1023, 1023]) IP OUT SHAPE torch.Size([2, 16129, 320]) inpaint_ipadapter.json
Note that the mask works perfectly fine with the inpainting controlnet. The IPAdapter also works well when the mask isn't included. The problem occurs when the mask is added into the IPAdapter.
I ran this workflow and, strangely, no errors occurred.
Adding mask.squeeze()
may solve the problem, but another error occurs for resolutions that are not divisible by 8.
I can confirm, the issue I was initially refering to was fixed. But the error message still appears if I try to do a second (hires) cycle, because the mask resolution does not match to the latent resolution anymore. It would be aweseome if this could be solved by automatically stretch scaling the mask to the latent image resolution! (?)
I have a solution to this problem and will update it, as a recent update to Comfy allows the aspect ratio of the image to be known.
Hi, was this ever pushed and solved?
Some specification changes have been made to the mask. It should be able to accept masks of any resolution.
Hi! When I try to add a mask like in the example you showed, this error appears during sampler node running:
The error appeared some ComfyUI updates ago.