Repository: stable-diffusion-webui
Issue: [Bug]: Cannot use CosXL_edit model
Labels: bug-report

### Checklist

- [X] The issue exists after disabling all extensions
- [X] The issue exists on a clean installation of webui
- [ ] The issue is caused by an extension, but I believe it is caused by a bug in the webui
- [X] The issue exists in the current version of the webui
- [X] The issue has not been reported before recently
- [ ] The issue has been reported before but has not been fixed yet

### What happened?

I cannot load CosXL models, I getting an error

### Steps to reproduce the problem

1. Download cosXL model to `stable-diffusion-webui/models/Stable-diffusion` folder
2. run ` ./webui.sh --xformers --share`
3.  Select the cosXL model from the Stable Diffusion checkpoint drop list

### What should have happened?

Successfully load the cosXL models

### What browsers do you use to access the UI ?

Google Chrome

### Sysinfo

[sysinfo-2024-08-09-08-32.json](https://github.com/user-attachments/files/16558455/sysinfo-2024-08-09-08-32.json)


### Console logs

```Shell
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye), Fedora 34+ and openSUSE Leap 15.4 or newer.
################################################################

################################################################
Running on usr_9110799_ulta_com user
################################################################

################################################################
python venv already activate or run without venv: /home/usr_9110799_ulta_com/.pyenv/versions/3.10.6/envs/venv
################################################################

################################################################
Launching launch.py...
################################################################
glibc version is 2.28
Check TCMalloc: libtcmalloc_minimal.so.4
./webui.sh: line 251: bc: command not found
./webui.sh: line 251: [: -eq: unary operator expected
libtcmalloc_minimal.so.4 is linked with libc.so,execute LD_PRELOAD=/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4
Python 3.10.6 (main, Jun 14 2024, 15:36:01) [GCC 8.3.0]
Version: v1.10.1
Commit hash: 82a973c04367123ae98bd9abdf80d9eda9b910e2
Launching Web UI with arguments: --xformers --share
ControlNet preprocessor location: /home/usr_9110799_ulta_com/stable-diffusion-webui/extensions/sd-webui-controlnet/annot
ator/downloads
2024-08-09 08:22:37,033 - ControlNet - INFO - ControlNet v1.1.455
Loading weights [b1689257e6] from /home/usr_9110799_ulta_com/stable-diffusion-webui/models/Stable-diffusion/juggernautXL
_versionXInpaint.safetensors
2024-08-09 08:22:41,022 - ControlNet - INFO - ControlNet UI callback registered.
Running on local URL:  http://127.0.0.1:7860
Running on public URL: https://c233e3f5b135bde185.gradio.live

This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)                                                                         Startup time: 99.9s (initial startup: 0.2s, prepare environment: 27.3s, import torch: 17.3s, import gradio: 14.3s, setup paths: 15.2s, import ldm: 0.1s, initialize shared: 1.5s, other imports: 6.5s, setup gfpgan: 0.2s, list SD models: 1.2s, load scripts: 5.6s, load upscalers: 0.2s, initialize extra networks: 1.0s, scripts before_ui_callback: 0.2s, create ui: 4.0s, gradio launch: 6.0s, add APIs: 0.3s).                                                                            Creating model from config: /home/usr_9110799_ulta_com/stable-diffusion-webui/configs/sd_xl_inpaint.yaml                /home/usr_9110799_ulta_com/.pyenv/versions/3.10.6/envs/venv/lib/python3.10/site-packages/huggingface_hub/file_download.py:1132: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.                                               warnings.warn( 
Calculating sha256 for /home/usr_9110799_ulta_com/stable-diffusion-webui/models/Stable-diffusion/cosxl_edit.safetensors: Applying attention optimization: xformers... done.                                                                     Model loaded in 144.7s (load weights from disk: 12.8s, create model: 1.2s, apply weights to model: 128.7s, apply half(): 0.1s, load textual inversion embeddings: 0.4s, calculate empty prompt: 1.3s).                                          49740ce22f75e367957c445b561ae5338a6529415bcdec8c043fb736bf80d77b                                                        Loading weights [49740ce22f] from /home/usr_9110799_ulta_com/stable-diffusion-webui/models/Stable-diffusion/cosxl_edit.safetensors                                                                                                              Creating model from config: /home/usr_9110799_ulta_com/stable-diffusion-webui/repositories/generative-models/configs/inference/sd_xl_base.yaml                                                                                                  /home/usr_9110799_ulta_com/.pyenv/versions/3.10.6/envs/venv/lib/python3.10/site-packages/huggingface_hub/file_download.py:1132: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.
  warnings.warn(
changing setting sd_model_checkpoint to cosxl_edit.safetensors: RuntimeError
Traceback (most recent call last):
  File "/home/usr_9110799_ulta_com/stable-diffusion-webui/modules/options.py", line 165, in set
    option.onchange()
  File "/home/usr_9110799_ulta_com/stable-diffusion-webui/modules/call_queue.py", line 14, in f
    res = func(*args, **kwargs)
  File "/home/usr_9110799_ulta_com/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/usr_9110799_ulta_com/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/usr_9110799_ulta_com/stable-diffusion-webui/modules/sd_models.py", line 845, in load_model
    load_model_weights(sd_model, checkpoint_info, state_dict, timer)
  File "/home/usr_9110799_ulta_com/stable-diffusion-webui/modules/sd_models.py", line 440, in load_model_weights
    model.load_state_dict(state_dict, strict=False)
  File "/home/usr_9110799_ulta_com/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/usr_9110799_ulta_com/stable-diffusion-webui/modules/sd_disable_initialization.py", line 221, in load_state_dict
    original(module, state_dict, strict=strict)
  File "/home/usr_9110799_ulta_com/.pyenv/versions/3.10.6/envs/venv/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 DiffusionEngine:
        size mismatch for model.diffusion_model.input_blocks.0.0.weight: copying a param with shape torch.Size([320, 8, 3, 3]) from checkpoint, the shape in current model is torch.Size([320, 4, 3, 3]).

```
```


### Additional information

According to the logs, the model seems to be loaded without errors, but the error rises when changing it on the sd_model_checkpoint drop down menu. Any help on this would be appreciated.