AttributeError: 'NoneType' object has no attribute 'sd_checkpoint_info'

#1
by ZeroCool22 - opened

Not working, when i try to change to the model i get this errors:

Applying attention optimization: xformers... done.
Model loaded in 4.2s (load weights from disk: 0.8s, create model: 0.3s, apply weights to model: 1.7s, apply half(): 0.8s, load VAE: 0.3s, calculate empty prompt: 0.3s).
Reusing loaded model 1.5\3dMixCharacter_v20Realism.safetensors [a4e0bdb838] to load sd_xl_base_1.0_inpainting_0.1.safetensors [fe1b97fe65]
Loading weights [fe1b97fe65] from C:\Users\ZeroCool22\Desktop\AutoSDXL\stable-diffusion-webui\models\Stable-diffusion\sd_xl_base_1.0_inpainting_0.1.safetensors
Creating model from config: C:\Users\ZeroCool22\Desktop\AutoSDXL\stable-diffusion-webui\repositories\generative-models\configs\inference\sd_xl_base.yaml
changing setting sd_model_checkpoint to sd_xl_base_1.0_inpainting_0.1.safetensors [fe1b97fe65]: RuntimeError
Traceback (most recent call last):
File "C:\Users\ZeroCool22\Desktop\AutoSDXL\stable-diffusion-webui\modules\options.py", line 140, in set
option.onchange()
File "C:\Users\ZeroCool22\Desktop\AutoSDXL\stable-diffusion-webui\modules\call_queue.py", line 13, in f
res = func(*args, **kwargs)
File "C:\Users\ZeroCool22\Desktop\AutoSDXL\stable-diffusion-webui\modules\initialize_util.py", line 170, in
shared.opts.onchange("sd_model_checkpoint", wrap_queued_call(lambda: sd_models.reload_model_weights()), call=False)
File "C:\Users\ZeroCool22\Desktop\AutoSDXL\stable-diffusion-webui\modules\sd_models.py", line 751, in reload_model_weights
load_model(checkpoint_info, already_loaded_state_dict=state_dict)
File "C:\Users\ZeroCool22\Desktop\AutoSDXL\stable-diffusion-webui\modules\sd_models.py", line 626, in load_model
load_model_weights(sd_model, checkpoint_info, state_dict, timer)
File "C:\Users\ZeroCool22\Desktop\AutoSDXL\stable-diffusion-webui\modules\sd_models.py", line 353, in load_model_weights
model.load_state_dict(state_dict, strict=False)
File "C:\Users\ZeroCool22\Desktop\AutoSDXL\stable-diffusion-webui\modules\sd_disable_initialization.py", line 223, in
module_load_state_dict = self.replace(torch.nn.Module, 'load_state_dict', lambda *args, **kwargs: load_state_dict(module_load_state_dict, *args, **kwargs))
File "C:\Users\ZeroCool22\Desktop\AutoSDXL\stable-diffusion-webui\modules\sd_disable_initialization.py", line 221, in load_state_dict
original(module, state_dict, strict=strict)
File "C:\Users\ZeroCool22\Desktop\AutoSDXL\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 2041, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for DiffusionEngine:
size mismatch for model.diffusion_model.input_blocks.0.0.weight: copying a param with shape torch.Size([320, 9, 3, 3]) from checkpoint, the shape in current model is torch.Size([320, 4, 3, 3]).

changing setting sd_vae to sdxl_vae.safetensors: AttributeError
Traceback (most recent call last):
File "C:\Users\ZeroCool22\Desktop\AutoSDXL\stable-diffusion-webui\modules\options.py", line 140, in set
option.onchange()
File "C:\Users\ZeroCool22\Desktop\AutoSDXL\stable-diffusion-webui\modules\call_queue.py", line 13, in f
res = func(*args, **kwargs)
File "C:\Users\ZeroCool22\Desktop\AutoSDXL\stable-diffusion-webui\modules\initialize_util.py", line 171, in
shared.opts.onchange("sd_vae", wrap_queued_call(lambda: sd_vae.reload_vae_weights()), call=False)
File "C:\Users\ZeroCool22\Desktop\AutoSDXL\stable-diffusion-webui\modules\sd_vae.py", line 255, in reload_vae_weights
checkpoint_info = sd_model.sd_checkpoint_info
AttributeError: 'NoneType' object has no attribute 'sd_checkpoint_info'

Same with your VAE:

https://justpaste.it/3gjx5

Hello,

  1. appears to be some sort of misuse on the part of SD Web UI. The principal issue is here:
size mismatch for model.diffusion_model.input_blocks.0.0.weight: copying a param with shape torch.Size([320, 9, 3, 3]) from checkpoint, the shape in current model is torch.Size([320, 4, 3, 3]).

The most significant difference between inpainting and non-inpainting is the number of input channels. Non-inpainting has four input channels, and inpainting has nine. The difference between the two sizes here is precisely the 9 and 4 at dimension 1. Basically, SD Web UI is expecting to be loading a non-inpainting model, and is throwing an error when it loads the inpainting one. I am uncertain how you tried to use this model in the web UI, but in whatever situation that is, sd_xl_base_1.0_inpainting_0.1.safetensors is not intended to be used there.

  1. is a misunderstanding. sd_xl_base_1.0_fp16_vae.safetensors is not a standalone autoencoder model, it is the entirety of SDXL 1.0 Base with different baked VAE weights (https://huggingface.co/madebyollin/sdxl-vae-fp16-fix/tree/main). It's a checkpoint that can be used like any other. There are two scenarios where this model is useful - a) when you want to use MadeByOllin's VAE by default, instead of XL 1.0 or XL 0.9, or b) when using the model as part of a calculation for merging models, as detailed in the model card.

Ok, but how i fix it?

I met this issue as well, just put sd_xl_base_1.0_inpainting_0.1.safetensors file to A1111 webui /models/Stable-diffusion folder, then launch ./webui.sh, it shows "Traceback (most recent call last):
File "/mnt/workspace/stable-diffusion-webui/modules/options.py", line 140, in set
option.onchange()
File "/mnt/workspace/stable-diffusion-webui/modules/call_queue.py", line 13, in f
res = func(*args, **kwargs)
File "/mnt/workspace/stable-diffusion-webui/modules/initialize_util.py", line 170, in
shared.opts.onchange("sd_model_checkpoint", wrap_queued_call(lambda: sd_models.reload_model_weights()), call=False)
File "/mnt/workspace/stable-diffusion-webui/modules/sd_models.py", line 755, in reload_model_weights
load_model_weights(sd_model, checkpoint_info, state_dict, timer)
File "/mnt/workspace/stable-diffusion-webui/modules/sd_models.py", line 353, in load_model_weights
model.load_state_dict(state_dict, strict=False)
File "/mnt/workspace/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2041, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for DiffusionEngine:
size mismatch for model.diffusion_model.input_blocks.0.0.weight: copying a param with shape torch.Size([320, 9, 3, 3]) from checkpoint, the shape in current model is torch.Size([320, 4, 3, 3])."

Getting this error here when trying to load the merged model in Automatic1111:

RuntimeError: Error(s) in loading state_dict for DiffusionEngine:
size mismatch for model.diffusion_model.input_blocks.0.0.weight: copying a param with shape torch.Size([320, 9, 3, 3]) from checkpoint, the shape in current model is torch.Size([320, 4, 3, 3]).

Hello to all Automatic1111 users,

Wang Qiyao added support for this model two weeks ago in the main branch. At this time I do not believe there has been a release since this change was made, so if you want to use this right now, you will need to clone from source.

Hello to all Automatic1111 users,

Wang Qiyao added support for this model two weeks ago in the main branch. At this time I do not believe there has been a release since this change was made, so if you want to use this right now, you will need to clone from source.

Thank you!

benjamin-paine changed discussion status to closed

Sign up or log in to comment