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

[Bug]: RuntimeError: shape '[1280, 1280, 3, 3]' is invalid for input of size 2337442

Open kagura21 opened this issue 1 year ago • 5 comments

Is there an existing issue for this?

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

What happened?

Just want to try out stable diffusion for the first time and i got this error during installation

loading stable diffusion model: RuntimeError
Traceback (most recent call last):
  File "D:\Stable Diffusion\stable-diffusion-webui\webui.py", line 136, in initialize
    modules.sd_models.load_model()
  File "D:\Stable Diffusion\stable-diffusion-webui\modules\sd_models.py", line 407, in load_model
    state_dict = get_checkpoint_state_dict(checkpoint_info, timer)
  File "D:\Stable Diffusion\stable-diffusion-webui\modules\sd_models.py", line 262, in get_checkpoint_state_dict
    res = read_state_dict(checkpoint_info.filename)
  File "D:\Stable Diffusion\stable-diffusion-webui\modules\sd_models.py", line 241, in read_state_dict
    pl_sd = safetensors.torch.load_file(checkpoint_file, device=device)
  File "D:\Stable Diffusion\stable-diffusion-webui\venv\lib\site-packages\safetensors\torch.py", line 100, in load_file
    result[k] = f.get_tensor(k)
RuntimeError: shape '[1280, 1280, 3, 3]' is invalid for input of size 2337442

Steps to reproduce the problem

  1. I just launch webui-user.bat

What should have happened?

I cannot find anyone that has this error during setup.

Commit where the problem happens

a9fed7c364061ae6efb37f797b6b522cb3cf7aa2

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

--xformers

List of extensions

nope just vanilla from the github

Console logs

venv "D:\Stable Diffusion\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Commit hash: a9fed7c364061ae6efb37f797b6b522cb3cf7aa2
Installing requirements for Web UI
Launching Web UI with arguments: --xformers
Loading weights [32c1033161] from D:\Stable Diffusion\stable-diffusion-webui\models\Stable-diffusion\v1-5-pruned-emaonly.safetensors
loading stable diffusion model: RuntimeError
Traceback (most recent call last):
  File "D:\Stable Diffusion\stable-diffusion-webui\webui.py", line 136, in initialize
    modules.sd_models.load_model()
  File "D:\Stable Diffusion\stable-diffusion-webui\modules\sd_models.py", line 407, in load_model
    state_dict = get_checkpoint_state_dict(checkpoint_info, timer)
  File "D:\Stable Diffusion\stable-diffusion-webui\modules\sd_models.py", line 262, in get_checkpoint_state_dict
    res = read_state_dict(checkpoint_info.filename)
  File "D:\Stable Diffusion\stable-diffusion-webui\modules\sd_models.py", line 241, in read_state_dict
    pl_sd = safetensors.torch.load_file(checkpoint_file, device=device)
  File "D:\Stable Diffusion\stable-diffusion-webui\venv\lib\site-packages\safetensors\torch.py", line 100, in load_file
    result[k] = f.get_tensor(k)
RuntimeError: shape '[1280, 1280, 3, 3]' is invalid for input of size 2337442


Stable diffusion model failed to load, exiting
Press any key to continue . . .

Additional information

No response

kagura21 avatar Mar 20 '23 17:03 kagura21

Can confirm. I have the same error.

Z4urce avatar Mar 21 '23 00:03 Z4urce

我也有同样的错误。 image

liangOL avatar Mar 21 '23 08:03 liangOL

Can confirm. I have the same error. The only difference is my RuntimeError is: RuntimeError: shape '[1280, 2560, 3, 3]' is invalid for input of size 24415943

Kindpire avatar Mar 22 '23 09:03 Kindpire

you need to download sd-v1-4.ckpt from https://huggingface.co/CompVis/stable-diffusion-v-1-4-original then put it in directory ...stable-diffusion-webui\models\Stable-diffusion and rename the file as Model.ckpt then in directory ...stable-diffusion-webui change the webui-user.bat : ... set COMMANDLINE_ARGS= git pull call webui.bat

then you can open webui-user.bat and it works (at least it helped me)

GrSvtn avatar Mar 22 '23 13:03 GrSvtn

thX for @GrSvtn ,i can run

flow3rcn avatar Mar 24 '23 05:03 flow3rcn

Lot of head scratching to get here - thanks @kagura21 for asking and thanks @GrSvtn for answering - FINALLY WORKING <3

conorluddy avatar Apr 19 '23 18:04 conorluddy

RuntimeError: shape '[2, -1, 8, 40]' is invalid for input of size 24640

not working

aaronkingdom avatar Jun 07 '23 05:06 aaronkingdom

RuntimeError: shape '[2, -1, 8, 40]' is invalid for input of size 24640

not working

I was getting this exact same error while attempting to apply a Reference preprocessor on ControlNet v1.1.224.

Fixed it by going to webUI Settings > Optimizations and setting "Negative Guidance minimum sigma" to zero.

casadan avatar Jun 25 '23 20:06 casadan