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

Unable to Load Stable Diffusion 2.0 Custom Model ckpt (768-v-ema.ckpt) #347

Open
eshack94 opened this issue Dec 4, 2022 · 18 comments
Open

Comments

@eshack94
Copy link

eshack94 commented Dec 4, 2022

Error output thrown to UI:

Error Traceback (most recent call last):
File "convert_model.py", line 42, in <module>
AssertionError: ('shape mismatch at', 'model.diffusion_model.input_blocks.1.1.proj_in.weight', [320, 320], (320, 320, 1, 1))
[27993] Failed to execute script 'convert_model' due to unhandled exception!

Trying to load the new Stable Diffusion model as a Custom Model.

More info:

  • Apple M1 Pro
  • 16 GB
  • MacOS 13.0.1 (22A400)
  • DiffusionBee Version 1.5.1 (0016)

Has anyone seen this, and is there a workaround for this? Or is this a known problem that requires code changes to add full support for?

@eshack94
Copy link
Author

eshack94 commented Dec 4, 2022

@theorhythm
Copy link

I have a similar issue, cannot import a custom model

Error Traceback (most recent call last):
File "convert_model.py", line 47, in <module>
AssertionError
[3182] Failed to execute script 'convert_model' due to unhandled exception!

@CrudeDiatribe
Copy link
Contributor

@theorhythm hopefully the next version fixes most imports of 1.4 and 1.5 based models.

@eshack94 the importer makes sure that the model is as expected. If you disable that check it will create the converted model but then Diffusion Bee will crash if you try to use it (at least the MPS version, I didn't try the TF version, maybe I should).

PS for any code spelunking, the linked script is not the version in DBee 1.5.1, you have to go back a commit. The logic in question is the same, though.

@lunarboy
Copy link

lunarboy commented Dec 6, 2022

Same issue when trying to import Anything v3.0.

@hal0thane
Copy link

Same issue when trying to import Anything v3.0.

For Anything v3.0, I was able to import the fp16 pruned version. Try that one if you haven't.

However, I'm having problems importing any model that I have merged in AUTOMATIC1111 -- and the models I'm merging do import just fine on their own, such as Anything v3/hitokomoro and EimisAnime/Spiderverse. The error I get with it is on line 28 in module KeyError: 'state_dict' [37613] Failed to execute script 'convert_model' due to unhandled exception!

A few other models I've downloaded from Huggingfaces also didn't import for me. I don't remember which ones, however.

@MDMAchine
Copy link

MDMAchine commented Dec 11, 2022

Same issue. I found a workaround by using this tool here:
https://github.com/eyriewow/merge-models

I ran a quick merge with 2 models which themselves imported previously on their own. It imported no problem, whereas prior trying AUTOMATIC1111 merging would result in the same error.

However using models that didn't import before resulting 'state_dict' cause the same error to appear using the linked merge script.

@hal0thane
Copy link

Thanks for the tip, @MDMAchine. As you said, the merge-models utility worked just fine. It serves as a good workaround for those who are comfortable using git and python from the terminal, but probably most DiffusionBee users are not. I'm glad to have it though. 😄

@metaphorz
Copy link

metaphorz commented Dec 14, 2022

Had the same issue when trying, within settings, to run V2.1 of Stable Diffusion as a "custom model". If the merge utility works, that could be a workaround. How would this work with the 2.1 checkpoint?

@MDMAchine
Copy link

MDMAchine commented Dec 14, 2022

@metaphorz
It likely will not work, DiffusionBee appears to import/convert similar to the script I linked. So if you use the script for any models that failed while importing into DiffusionBee they will fail with the same error.

Edit:
Its been addressed #319 for next update.
Thanks @CrudeDiatribe

@Bangkokian
Copy link

Same issue. Trying to load Protogen models. It's throwing this error:


Error Traceback (most recent call last):
File "convert_model.py", line 28, in <module>
KeyError: 'state_dict'
[24812] Failed to execute script 'convert_model' due to unhandled exception!

@CrudeDiatribe
Copy link
Contributor

CrudeDiatribe commented Jan 10, 2023

@Bangkokian PR #319 fixes this, just waiting for a new version of the app to include it.

@metaphorz
Copy link

In the meantime , I’ve been using the automatic1111 webui which has many options and will load multiple SD checkpoints

@luisdemarchi
Copy link

luisdemarchi commented Mar 1, 2023

The mac app is 1.5.1, from what I understand it's still the version with the bug. Do you have any date to publish the fix?

@CrudeDiatribe
Copy link
Contributor

The mac app is 1.5.1, from what I understand it's still the version with the bug. Do you have any date to publish the fix?

On the GitHub page, under releases you can find 1.5.2 which includes the updated importer which should import the 1.4/1.5 based models that were failing.

@luisdemarchi
Copy link

luisdemarchi commented Mar 2, 2023

@CrudeDiatribe I understood. the fix only happens for 1.4/1.5 versions. So it is currently not possible to import the 2.1 model?

In model v2.1-768px I am having a similar error from this issue:

Error Traceback (most recent call last):
File "convert_model.py", line 85, in
AssertionError: ('shape mismatch at', 'model.diffusion_model.input_blocks.1.1.proj_in.weight', [320, 320], (320, 320, 1, 1))
[98815] Failed to execute script 'convert_model' due to unhandled exception!

More info:

Apple M1 - 16 GB
MacOS 13.2.1 (22D68)
DiffusionBee Version 1.5.2 (0016)

@CrudeDiatribe
Copy link
Contributor

So it is currently not possible to import the 2.1 model?

Correct.

@Erik262
Copy link

Erik262 commented May 28, 2023

And this is still the case unfortunately 👎

@CrudeDiatribe
Copy link
Contributor

And this is still the case unfortunately 👎

Are you using the latest release from Github? SD2.x support was added per the release notes.

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

No branches or pull requests

10 participants