stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: ScuNET extensions "on" ScuNET button does not appear on the extra page

Open andyleeyuan opened this issue 2 years ago • 8 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

What happened?

I checked the ScuNET option at extensions page

but when I restart webui, ScuNET does not appear on the extra page

Steps to reproduce the problem

  1. checked the ScuNET
  2. restart webui
  3. go to extra page

What should have happened?

ScuNET should appear at extra page

Commit where the problem happens

d97f467c0d27695d23edad5e4f8898a57e0ccb00

What platforms do you use to access UI ?

No response

What browsers do you use to access the UI ?

No response

Command Line Arguments

No response

Additional information, context and logs

No response

andyleeyuan avatar Jan 15 '23 07:01 andyleeyuan

But how did it become unchecked in the first place? I unchecked it, scunet dissapeared from my upscalers list, then i checked it again and it appeared back. I cannot yet reproduce your issue.

mezotaken avatar Jan 15 '23 21:01 mezotaken

I know what the cause of this is, I looked into it the other day. There were 2 things that need attention.

  1. scunet_model.py is missing from modules, this is where it's loaded from so if it's not there it's not loaded.

Copy extensions-builtin/ScuNET/scripts/scunet_model.py into modules.

  1. The cleanup_models() function in modules/modelloader.py does not handle the path for the ScuNET models. I'm not 100% sure if this is required because I did this before I found the model wasn't being loaded but might as well do it right.

Add this to the end of the cleanup_models() function of modules/modelloader.py (line 79)

    dest_path = os.path.join(models_path, "ScuNET")
     move_files(src_path, dest_path)

The rest of the upscaler stuff is dynamic so I'm pretty sure thats all that is required for it to work anywhere the other upscalers do.

chrissaunders-wrc avatar Jan 15 '23 23:01 chrissaunders-wrc

scunet_model.py is missing from modules, this is where it's loaded from so if it's not there it's not loaded.

But that's not how it works. In webui.py scripts are intentionally loaded just before models

https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/ff6a5bcec1ce25aa8f08b157ea957d764be23d8d/webui.py#L66-L68

That's because every extension with upscaler creates a subclass via script https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/ff6a5bcec1ce25aa8f08b157ea957d764be23d8d/extensions-builtin/ScuNET/scripts/scunet_model.py#L15

And later they are all found here: https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/ff6a5bcec1ce25aa8f08b157ea957d764be23d8d/modules/modelloader.py#L160-L167

I'm pretty sure if auto had spare time he'd move all upscalers to extensions and removed parsing ./modules files, as it looks way dirtier than subclasses. I checked that it indeed creates subclass for me. When extension is unchecked, script won't be executed therefore associated upscaler wont be a subclass.

Cleanup lines for upscalers that are extensions now look weird and scunet missing among them is a mystery to me.

mezotaken avatar Jan 16 '23 04:01 mezotaken

It may not be how it supposed to work but can't argue with the results.....

Screenshot_20230116-143037

Something is messed up with the friendly names, I don't think those work, but the full filename ones do.

I haven't had ScuNET for a long time and extension for me was ticked and the models were in the ScuNET folder. One day they just disappeared from the list and yesterday I did the above and they are back

saunderez avatar Jan 16 '23 04:01 saunderez

I know what the cause of this is, I looked into it the other day. There were 2 things that need attention.

1. scunet_model.py is missing from modules, this is where it's loaded from so if it's not there it's not loaded.

Copy extensions-builtin/ScuNET/scripts/scunet_model.py into modules.

2. The cleanup_models() function in modules/modelloader.py does not handle the path for the ScuNET models. I'm not 100% sure if this is required  because I did this before I found the model wasn't being loaded but might as well do it right.

Add this to the end of the cleanup_models() function of modules/modelloader.py (line 79)

    dest_path = os.path.join(models_path, "ScuNET")
     move_files(src_path, dest_path)

The rest of the upscaler stuff is dynamic so I'm pretty sure thats all that is required for it to work anywhere the other upscalers do.

This method works for me,thx

andyleeyuan avatar Jan 18 '23 03:01 andyleeyuan

worked for me too tyvm

novaexe avatar Feb 26 '23 05:02 novaexe

ScuNET and SWINIR are indeed not appearing in the redraw/extra options

AIAMIAUTHOR avatar Mar 12 '23 18:03 AIAMIAUTHOR

To solve this, you may need to start a new "webui" folder from scratch. This bug appears in my old project folder, but not in the new one. or an extension compatibility problem.

AIAMIAUTHOR avatar Mar 16 '23 01:03 AIAMIAUTHOR

There's been a lot of rework to how the webui initializes over the last few months and I think this is resolved now. If not, feel free to re-open or open a new issue.

catboxanon avatar Aug 05 '23 03:08 catboxanon