diffusionbee-stable-diffusion-ui icon indicating copy to clipboard operation
diffusionbee-stable-diffusion-ui copied to clipboard

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

Open eshack94 opened this issue 3 years ago • 18 comments

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 avatar Dec 04 '22 00:12 eshack94

Looks like it's encountering some error while running this script: https://github.com/divamgupta/diffusionbee-stable-diffusion-ui/blob/master/backends/model_converter/convert_model.py

Edit: Looks like it's erroring out at this point in execution: https://github.com/divamgupta/diffusionbee-stable-diffusion-ui/blob/925de50b1cd0c42ffec16563fc86e26e2732d2f7/backends/model_converter/convert_model.py#LL85C55-L85C63

eshack94 avatar Dec 04 '22 00:12 eshack94

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!

theorhythm avatar Dec 04 '22 04:12 theorhythm

@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.

CrudeDiatribe avatar Dec 04 '22 19:12 CrudeDiatribe

Same issue when trying to import Anything v3.0.

lunarboy avatar Dec 06 '22 00:12 lunarboy

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.

hal0thane avatar Dec 08 '22 15:12 hal0thane

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.

MDMAchine avatar Dec 11 '22 18:12 MDMAchine

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. 😄

hal0thane avatar Dec 12 '22 08:12 hal0thane

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?

metaphorz avatar Dec 14 '22 13:12 metaphorz

@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

MDMAchine avatar Dec 14 '22 15:12 MDMAchine

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!

Bangkokian avatar Jan 10 '23 12:01 Bangkokian

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

CrudeDiatribe avatar Jan 10 '23 13:01 CrudeDiatribe

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

metaphorz avatar Jan 10 '23 14:01 metaphorz

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?

luisdemarchi avatar Mar 01 '23 21:03 luisdemarchi

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.

CrudeDiatribe avatar Mar 02 '23 00:03 CrudeDiatribe

@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)

luisdemarchi avatar Mar 02 '23 17:03 luisdemarchi

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

Correct.

CrudeDiatribe avatar Mar 02 '23 17:03 CrudeDiatribe

And this is still the case unfortunately 👎

Erik262 avatar May 28 '23 12:05 Erik262

And this is still the case unfortunately 👎

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

CrudeDiatribe avatar May 29 '23 16:05 CrudeDiatribe