chaiNNer-org / spandrel

Spandrel gives your project support for various PyTorch architectures meant for AI Super-Resolution, restoration, and inpainting. Based on the model support implemented in chaiNNer.
MIT License
138 stars 12 forks source link

Unable to load model #203

Closed Neokmi closed 6 months ago

Neokmi commented 6 months ago

Model 'E:\Git\stable-diffusion-webui\models\RealESRGAN\RealESRGAN_x4plus.pth' is not a 'ESRGAN' model (got <spandrel.architectures.ESRGAN.ESRGANArch object at 0x000001A42DE12D10>)

Model 'E:\Git\stable-diffusion-webui\models\ScuNET\ScuNET.pth' is not a 'SCUNet' model (got <spandrel.architectures.SCUNet.SCUNetArch object at 0x000001A42DE11630>)

Model 'E:\Git\stable-diffusion-webui\models\ESRGAN\ESRGAN_4x.pth' is not a 'ESRGAN' model (got <spandrel.architectures.ESRGAN.ESRGANArch object at 0x000001A42DE12D10>)

joeyballentine commented 6 months ago

Is this affecting all webui users?

RunDevelopment commented 6 months ago

Seems like webui didn't properly fix their spandrel version and accidentally upgraded to 0.3.0 which included breaking changes. Either that or dependencies were installed incorrectly.

Either way, this is an issue with webui, not spandrel.


On that note: Does webui even install spandrel as a dependency? I've seen lots of issues were people can't use models because spandrel isn't installed, and spandrel isn't in webui's requirements.txt. Here's a code search and "spandrel" doesn't appear anywhere where dependencies are installed.

joeyballentine commented 6 months ago

@akx probably something you'd wanna take a look at

akx commented 6 months ago

On that note: Does webui even install spandrel as a dependency? I've seen lots of issues were people can't use models because spandrel isn't installed, and spandrel isn't in webui's requirements.txt.

spandrel==0.1.6 is in requirements_versions.txt.

Is this affecting all webui users?

It's certainly not affecting me.

RunDevelopment commented 6 months ago

On that note: Does webui even install spandrel as a dependency? I've seen lots of issues were people can't use models because spandrel isn't installed, and spandrel isn't in webui's requirements.txt.

spandrel==0.1.6 is in requirements_versions.txt.

Ah. Custom install process. I thought requirements_versions.txt did something else...

Then I can only guess that the user manually installed the wrong version of spandrel. The errors they mentioned make it clear that they have spandrel==0.3.0 installed (because spandrel.architectures.ESRGAN.ESRGANArch was added in 0.3.0).

After a bit of googling, I found this reddit post. In it, the poster gets an error No module named 'spandrel' and the top comment recommends to pip install spandrel. The problem is that this pip command will install the latest version of spandrel. The latest version was 0.2.2 at the time the post was made, but it's 0.3.0 now.

@akx It might be worth investigating how that reddit user could have gotten No module named 'spandrel' in the first place. However, that's just a thought. I have no idea how webui works and maybe they are just doing something wrong. I can't say.


In any case, I'm going to close this issue now. No matter how the wrong version of spandrel got installed, it doesn't have anything to do with spandrel itself.

akx commented 6 months ago

My best guess: updated webui to the new non-dev version which uses spandrel, ran with python webui.py, not launch.py (which installs requirements and so on).

But yeah, definitely not a bug in Spandrel :)

akx commented 6 months ago

As an aside, you can just about almost see, if you squint a bit, when Spandrel use was released to master in webui... 😂

https://pypistats.org/packages/spandrel