AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
139.5k stars 26.44k forks source link

changing setting sd_model_checkpoint to SD3\sd3_medium.safetensors [cc236278d2]: RuntimeError #16277

Open kkget opened 1 month ago

kkget commented 1 month ago

Checklist

What happened?

E:\sd-webui-aki\sd-webui-aki-v4\configs\sd3-inference.yaml Loading VAE weights specified in settings: E:\sd-webui-aki\sd-webui-aki-v4\models\VAE\sdxl_vae.safetensors changing setting sd_model_checkpoint to SD3\sd3_medium.safetensors [cc236278d2]: RuntimeError Traceback (most recent call last): File "E:\sd-webui-aki\sd-webui-aki-v4\modules\options.py", line 165, in set option.onchange() File "E:\sd-webui-aki\sd-webui-aki-v4\modules\call_queue.py", line 14, in f res = func(*args, kwargs) File "E:\sd-webui-aki\sd-webui-aki-v4\modules\initialize_util.py", line 181, in shared.opts.onchange("sd_model_checkpoint", wrap_queued_call(lambda: sd_models.reload_model_weights()), call=False) File "E:\sd-webui-aki\sd-webui-aki-v4\modules\sd_models.py", line 977, in reload_model_weights load_model(checkpoint_info, already_loaded_state_dict=state_dict) File "E:\sd-webui-aki\sd-webui-aki-v4\modules\sd_models.py", line 845, in load_model load_model_weights(sd_model, checkpoint_info, state_dict, timer) File "E:\sd-webui-aki\sd-webui-aki-v4\modules\sd_models.py", line 538, in load_model_weights sd_vae.load_vae(model, vae_file, vae_source) File "E:\sd-webui-aki\sd-webui-aki-v4\modules\sd_vae.py", line 212, in load_vae _load_vae_dict(model, vae_dict_1) File "E:\sd-webui-aki\sd-webui-aki-v4\modules\sd_vae.py", line 239, in _load_vae_dict model.first_stage_model.load_state_dict(vae_dict_1) File "E:\sd-webui-aki\sd-webui-aki-v4\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 "E:\sd-webui-aki\sd-webui-aki-v4\modules\sd_disable_initialization.py", line 221, in load_state_dict original(module, state_dict, strict=strict) File "E:\sd-webui-aki\sd-webui-aki-v4\py310\lib\site-packages\torch\nn\modules\module.py", line 2152, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for SDVAE: Unexpected key(s) in state_dict: "post_quant_conv.bias", "post_quant_conv.weight", "quant_conv.bias", "quant_conv.weight". size mismatch for encoder.conv_out.weight: copying a param with shape torch.Size([8, 512, 3, 3]) from checkpoint, the shape in current model is torch.Size([32, 512, 3, 3]). size mismatch for encoder.conv_out.bias: copying a param with shape torch.Size([8]) from checkpoint, the shape in current model is torch.Size([32]). size mismatch for decoder.conv_in.weight: copying a param with shape torch.Size([512, 4, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 16, 3, 3]).

Steps to reproduce the problem

start webui -->Switching Models to SD3

What should have happened?

start webui

What browsers do you use to access the UI ?

No response

Sysinfo

win11 py3.10

Console logs

E:\sd-webui-aki\sd-webui-aki-v4\configs\sd3-inference.yaml
Loading VAE weights specified in settings: E:\sd-webui-aki\sd-webui-aki-v4\models\VAE\sdxl_vae.safetensors
changing setting sd_model_checkpoint to SD3\sd3_medium.safetensors [cc236278d2]: RuntimeError
Traceback (most recent call last):
  File "E:\sd-webui-aki\sd-webui-aki-v4\modules\options.py", line 165, in set
    option.onchange()
  File "E:\sd-webui-aki\sd-webui-aki-v4\modules\call_queue.py", line 14, in f
    res = func(*args, **kwargs)
  File "E:\sd-webui-aki\sd-webui-aki-v4\modules\initialize_util.py", line 181, in <lambda>
    shared.opts.onchange("sd_model_checkpoint", wrap_queued_call(lambda: sd_models.reload_model_weights()), call=False)
  File "E:\sd-webui-aki\sd-webui-aki-v4\modules\sd_models.py", line 977, in reload_model_weights
    load_model(checkpoint_info, already_loaded_state_dict=state_dict)
  File "E:\sd-webui-aki\sd-webui-aki-v4\modules\sd_models.py", line 845, in load_model
    load_model_weights(sd_model, checkpoint_info, state_dict, timer)
  File "E:\sd-webui-aki\sd-webui-aki-v4\modules\sd_models.py", line 538, in load_model_weights
    sd_vae.load_vae(model, vae_file, vae_source)
  File "E:\sd-webui-aki\sd-webui-aki-v4\modules\sd_vae.py", line 212, in load_vae
    _load_vae_dict(model, vae_dict_1)
  File "E:\sd-webui-aki\sd-webui-aki-v4\modules\sd_vae.py", line 239, in _load_vae_dict
    model.first_stage_model.load_state_dict(vae_dict_1)
  File "E:\sd-webui-aki\sd-webui-aki-v4\modules\sd_disable_initialization.py", line 223, in <lambda>
    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 "E:\sd-webui-aki\sd-webui-aki-v4\modules\sd_disable_initialization.py", line 221, in load_state_dict
    original(module, state_dict, strict=strict)
  File "E:\sd-webui-aki\sd-webui-aki-v4\py310\lib\site-packages\torch\nn\modules\module.py", line 2152, in load_state_dict
    raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for SDVAE:
        Unexpected key(s) in state_dict: "post_quant_conv.bias", "post_quant_conv.weight", "quant_conv.bias", "quant_conv.weight".
        size mismatch for encoder.conv_out.weight: copying a param with shape torch.Size([8, 512, 3, 3]) from checkpoint, the shape in current model is torch.Size([32, 512, 3, 3]).
        size mismatch for encoder.conv_out.bias: copying a param with shape torch.Size([8]) from checkpoint, the shape in current model is torch.Size([32]).
        size mismatch for decoder.conv_in.weight: copying a param with shape torch.Size([512, 4, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 16, 3, 3]).

Additional information

No response

stringency commented 1 month ago

Have you updated the latest version of SDWebUI?

l0stl0rd commented 1 month ago

I get the same issue on MacOS not sure why, even with the latest release.

stringency commented 1 month ago

您好,您发的文件已经收到,谢谢!

42Swampy commented 1 month ago

Same with Ubuntu 22.04:

Loading weights [cc236278d2] from /home/alexander/stable-diffusion-webui/models/Stable-diffusion/sd3_medium.safetensors Creating model from config: /home/alexander/stable-diffusion-webui/configs/sd3-inference.yaml Loading VAE weights specified in settings: /home/alexander/stable-diffusion-webui/models/VAE/sdxl.vae.safetensors changing setting sd_model_checkpoint to sd3_medium.safetensors [cc236278d2]: RuntimeError Traceback (most recent call last): File "/home/alexander/stable-diffusion-webui/modules/options.py", line 165, in set option.onchange() File "/home/alexander/stable-diffusion-webui/modules/call_queue.py", line 14, in f res = func(*args, **kwargs) File "/home/alexander/stable-diffusion-webui/modules/initialize_util.py", line 181, in <lambda> shared.opts.onchange("sd_model_checkpoint", wrap_queued_call(lambda: sd_models.reload_model_weights()), call=False) File "/home/alexander/stable-diffusion-webui/modules/sd_models.py", line 977, in reload_model_weights load_model(checkpoint_info, already_loaded_state_dict=state_dict) File "/home/alexander/stable-diffusion-webui/modules/sd_models.py", line 845, in load_model load_model_weights(sd_model, checkpoint_info, state_dict, timer) File "/home/alexander/stable-diffusion-webui/modules/sd_models.py", line 538, in load_model_weights sd_vae.load_vae(model, vae_file, vae_source) File "/home/alexander/stable-diffusion-webui/modules/sd_vae.py", line 212, in load_vae _load_vae_dict(model, vae_dict_1) File "/home/alexander/stable-diffusion-webui/modules/sd_vae.py", line 239, in _load_vae_dict model.first_stage_model.load_state_dict(vae_dict_1) File "/home/alexander/stable-diffusion-webui/modules/sd_disable_initialization.py", line 223, in <lambda> 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 "/home/alexander/stable-diffusion-webui/modules/sd_disable_initialization.py", line 221, in load_state_dict original(module, state_dict, strict=strict) File "/home/alexander/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2152, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for SDVAE: Unexpected key(s) in state_dict: "post_quant_conv.bias", "post_quant_conv.weight", "quant_conv.bias", "quant_conv.weight". size mismatch for encoder.conv_out.weight: copying a param with shape torch.Size([8, 512, 3, 3]) from checkpoint, the shape in current model is torch.Size([32, 512, 3, 3]). size mismatch for encoder.conv_out.bias: copying a param with shape torch.Size([8]) from checkpoint, the shape in current model is torch.Size([32]). size mismatch for decoder.conv_in.weight: copying a param with shape torch.Size([512, 4, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 16, 3, 3]).

kkget commented 1 month ago

Have you updated the latest version of SDWebUI?

Yes

Sellorio commented 1 month ago

I solved this by going to Settings / VAE and setting the VAE to None. I think non-SD3 VAE's aren't compatible with SD3.

l0stl0rd commented 1 month ago

true works, did not realize I had a VAE set 😶

kkget commented 4 weeks ago

我通过转到“设置/ VAE”并将VAE设置为“无”来解决了这个问题。我认为非 SD3 VAE 与 SD3 不兼容。

I used this setting, but it still doesn't take effect