continue-revolution / sd-webui-segment-anything

Segment Anything for Stable Diffusion WebUI
3.41k stars 206 forks source link

[Bug]: Fails to load if control net is not installed. TypeError: '<' not supported between instances of 'NoneType' and 'int' #47

Closed tpsjr7 closed 1 year ago

tpsjr7 commented 1 year ago

Is there an existing issue for this?

Have you updated WebUI and this extension to the newest version?

Do you understand that you should go to https://github.com/IDEA-Research/Grounded-Segment-Anything/issues if you cannot install GroundingDINO?

What happened?

i tried to install this extension but it fails with this error

Traceback (most recent call last):
  File "X:\stable-diffusion-webui\modules\scripts.py", line 270, in wrap_call
    res = func(*args, **kwargs)
  File "X:\stable-diffusion-webui\extensions\sd-webui-segment-anything\scripts\sam.py", line 329, in ui
    priorize_sam_scripts(is_img2img)
  File "X:\stable-diffusion-webui\extensions\sd-webui-segment-anything\scripts\sam.py", line 304, in priorize_sam_scripts
    if cnet_idx < sam_idx:c
TypeError: '<' not supported between instances of 'NoneType' and 'int'`

When I look at it, it appears to fail on cnet_idx < sam_idx: and I believe that is because I don't have the control net extension installed so it fails because cnet_idx is None.

Steps to reproduce the problem

  1. Don't have control net extension installed.
  2. Install this sd-webui-segment-anything extension
  3. Start the app, and view the error 'TypeError: '<' not supported between instances of 'NoneType' and 'int'`'

What should have happened?

The app should load and I should see this extension appear.

Commit where the problem happens

webui: ebd3758129d3dbfc9796273fea2022e0ef4e6daf ( should be latest ) extension: 4ee968b5

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

no

Console logs

not relevant

Additional information

maybe you can initialize cnet_idx to a high number like 100000000 instead of None, then it wouldn't fail the comparison.

continue-revolution commented 1 year ago

Yes, my bad. I will update soon.