Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with Mask by Text node. #9

Open
kerbi opened this issue Aug 24, 2023 · 10 comments · May be fixed by #16
Open

Error with Mask by Text node. #9

kerbi opened this issue Aug 24, 2023 · 10 comments · May be fixed by #16

Comments

@kerbi
Copy link

kerbi commented Aug 24, 2023

Hi ! I'm getting this error whenever I want to use the Mask by Text node :

Error occurred when executing Mask By Text:

No module named 'clipseg.clipseg'; 'clipseg' is not a package

  File "F:\Stable Diffusion\comfyui\execution.py", line 151, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
  File "F:\Stable Diffusion\comfyui\execution.py", line 81, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
  File "F:\Stable Diffusion\comfyui\execution.py", line 74, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
  File "F:\Stable Diffusion\comfyui\custom_nodes\masquerade-nodes-comfyui\MaskNodes.py", line 136, in get_mask
    model = self.load_model()
  File "F:\Stable Diffusion\comfyui\custom_nodes\masquerade-nodes-comfyui\MaskNodes.py", line 183, in load_model
    from clipseg.clipseg import CLIPDensePredT

I've tried to manually install the clipseg and clip packages with pip in case it were missing, but no, it doesn't fix the issue.
I can do the import without errors in my virtual env, so I don't understand why it fails in the script.

Any idea ?

Thanks in advance and thanks for the nodes.

@manny5457
Copy link

Had the same error, search for a CLIPSeg node, and swap it for your old node and it should work. Did with mine.

@le-khang
Copy link

le-khang commented Sep 18, 2023

I have the same error. ClipSEG works as a great replacement but I would love to have the negative prompt in the node of BadCafeCode to exclude nearby objects. How should I fix this issue please?
2023-09-18 17_13_36-ComfyUI
2023-09-18 17_15_29-ComfyUI

@hben35096
Copy link

Had the same error

@hben35096
Copy link

I think I've found a way to get close by adding "from clipseg.clipseg import CLIPDensePredT" to the top code in the MaskNodes.py file

import os
import torch
import numpy as np
import math
from torchvision import transforms
from torchvision.ops import masks_to_boxes
from clipseg.clipseg import CLIPDensePredT
import torchvision.transforms.functional as TF
import torch.nn.functional as torchfn
import subprocess
import sys

@Duemellon
Copy link

I tried that edit but did not resolve it.

@hben35096
Copy link

Did you install clipseg?

@April93
Copy link

April93 commented Oct 19, 2023

I get this import error only when "ComfyUI's ControlNet Auxiliary Preprocessors" is installed/enabled. Disabling it allows Mask by Text to work properly. Seems there's an import conflict?

Using the alternative "clipseg" node isn't a proper alternative as it functions differently.

@bananasss00
Copy link

I fixed it this way:

  1. raised the import to the top as hben35096 said Error with Mask by Text node. #9 (comment)
  2. renamed the extension masquerade-nodes-comfyui -> 1masquerade-nodes-comfyui (so it would load first)
  3. no more error

@alexbofa alexbofa linked a pull request Nov 15, 2023 that will close this issue
@Phando
Copy link

Phando commented Nov 17, 2023

Tried several of these solutions, still looking for a fix. Thanks for the great masks!

@merc4derp
Copy link

I've been having the same problem and I've pinpointed the issue for my installation at least, can't promise it will fix yours too.

The problematic node was clipseg, which is installed in the main ComfyUI\custom_nodes\ folder without a subfolder of its own.

Removing it through the manager (or simply deleting the clipseg.py file in the custom nodes folder) fixes masquerade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants