You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have solved the problem for myself by modifying the file “SwarmUI/src/BuiltinExtensions/ComfyUIBackend/ExtraNodes/SwarmComfyCommon/SwarmClipSeg.py” as follows:
Added "import inspect"
Lines 57-58, original:
with torch.no_grad():
mask = model(**processor(text=match_text, images=img, return_tensors="pt", padding=True))[0]
Changed as follows:
# use inspect.signature to check whether model.forward accepts interpolate_pos_encoding
kwargs = (
{"interpolate_pos_encoding": True}
if "interpolate_pos_encoding" in inspect.signature(model.forward).parameters
else {}
)
with torch.no_grad():
mask = model(**processor(text=match_text, images=img, return_tensors="pt", padding=True), **kwargs)[0]
That solved the problem for me. The segmentation works as expected again.
But since I don't have a clue about SwarmUI internals, Python or generative AI, I can't estimate what risks and side effects this “solution” has. Please take this only as an indication of where the problem might lie.
The text was updated successfully, but these errors were encountered:
And note that the second thread you linked is literally from me reporting the bug and requesting a fix, which they then pushed a fix, which was included in the next release.
So, adjust the answer in the previous thread from install an old version, to install the new version
Open a terminal to (Swarm)\dlbackend\comfy and run python_embeded\python -s -m pip install -U transformers to update it to latest (4.47.0) which has the bug already fixed.
(or if in linux do it with the venv instead of python_embeded)
Expected Behavior
Expected Automatic Segmentation and Refining working as described here:
https://github.com/mcmonkeyprojects/SwarmUI/blob/master/docs/Features/Prompt%20Syntax.md#automatic-segmentation-and-refining
and here:
Stability-AI/StableSwarmUI#11 (comment)
Actual Behavior
ComfyUI execution error: Input image size (352*352) doesn't match model (224*224).
Steps to Reproduce
Generating an image with following prompt:
leads to error:
ComfyUI execution error: Input image size (352*352) doesn't match model (224*224).
Debug Logs
https://paste.denizenscript.com/View/129007
Other
I did some googling and found the following issues that could be related to the error:
comfyanonymous/ComfyUI#5402
huggingface/transformers#34415
I have solved the problem for myself by modifying the file “SwarmUI/src/BuiltinExtensions/ComfyUIBackend/ExtraNodes/SwarmComfyCommon/SwarmClipSeg.py” as follows:
Added "import inspect"
Lines 57-58, original:
Changed as follows:
The modified file is attached.
SwarmClipSeg.zip
That solved the problem for me. The segmentation works as expected again.
But since I don't have a clue about SwarmUI internals, Python or generative AI, I can't estimate what risks and side effects this “solution” has. Please take this only as an indication of where the problem might lie.
The text was updated successfully, but these errors were encountered: