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

[Bug]: RuntimeError: self.size(-1) must be divisible by 4 to view Byte as Float (different element sizes), but got 461271

Open Bruno-Noobador opened this issue 1 year ago • 2 comments

Is there an existing issue for this?

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

What happened?

During install

Steps to reproduce the problem

  1. Go to ....
  2. Press ....
  3. ...

What should have happened?

Proper installation

Commit where the problem happens

Main

What platforms do you use to access the UI ?

No response

What browsers do you use to access the UI ?

No response

Command Line Arguments

During installation

List of extensions

No

Console logs

Downloading: "https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors" to C:\Users\bruno\Downloads\stable-diffusion-webui\models\Stable-diffusion\v1-5-pruned-emaonly.safetensors

  8%|██████▍                                                                       | 333M/3.97G [00:33<06:15, 10.4MB/s]
Calculating sha256 for C:\Users\bruno\Downloads\stable-diffusion-webui\models\Stable-diffusion\v1-5-pruned-emaonly.safetensors: 98b64029eae247400ba6004e873da65ba2c0ae3fc5231879c912cadf68f6b80f
Loading weights [98b64029ea] from C:\Users\bruno\Downloads\stable-diffusion-webui\models\Stable-diffusion\v1-5-pruned-emaonly.safetensors
loading stable diffusion model: RuntimeError
Traceback (most recent call last):
  File "C:\Users\bruno\Downloads\stable-diffusion-webui\webui.py", line 136, in initialize
    modules.sd_models.load_model()
  File "C:\Users\bruno\Downloads\stable-diffusion-webui\modules\sd_models.py", line 407, in load_model
    state_dict = get_checkpoint_state_dict(checkpoint_info, timer)
  File "C:\Users\bruno\Downloads\stable-diffusion-webui\modules\sd_models.py", line 262, in get_checkpoint_state_dict
    res = read_state_dict(checkpoint_info.filename)
  File "C:\Users\bruno\Downloads\stable-diffusion-webui\modules\sd_models.py", line 241, in read_state_dict
    pl_sd = safetensors.torch.load_file(checkpoint_file, device=device)
  File "C:\Users\bruno\Downloads\stable-diffusion-webui\venv\lib\site-packages\safetensors\torch.py", line 100, in load_file
    result[k] = f.get_tensor(k)
RuntimeError: self.size(-1) must be divisible by 4 to view Byte as Float (different element sizes), but got 461271


Stable diffusion model failed to load, exiting

Additional information

No response

Bruno-Noobador avatar Mar 15 '23 15:03 Bruno-Noobador

Hi, I had a similar issue, but I managed to solve it by downloading the checkpoint model file from this repository: runwayml/stable-diffusion-v1-5. I simply renamed the model file to model.ckpt and placed it in the models directory. After doing so, the installation was successful. Maybe you can try this approach as well.

pyronn avatar Mar 20 '23 17:03 pyronn

Same issue with mine, but with a different value. RuntimeError: self.size(-1) must be divisible by 4 to view Byte as Float (different element sizes), but got 121908318

Edit: resolved by renaming any ckpt file into model.ckpt and placing it into the models/Stable-diffusion folder.****

aytoast avatar Mar 20 '23 17:03 aytoast

Same issue with mine, the above solution works fine on my windows10 PC

Valkierja avatar Mar 30 '23 11:03 Valkierja

your file "v1-5-pruned-emaonly.safetensors" is broken, you should download it agian. You can download it again from https://huggingface.co/runwayml/stable-diffusion-v1-5/blob/main/v1-5-pruned-emaonly.safetensors to fix this error. the file is localated in folder "stable-diffusion-webui/models/Stable-diffusion/", you should replace it with the new downloaded one.

soueer avatar Apr 08 '23 02:04 soueer