Repository: stable-diffusion-webui
Issue: [Bug]: Max RAM Usage (32GB)
Labels: bug-report

### Is there an existing issue for this?

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

### What happened?

I try to merge 2 checkpoints until I noticed that I was running out RAM having 32GB

![28b5d0fe21017c4887914047587f034c](https://user-images.githubusercontent.com/45272190/235729104-62373744-fe26-43f2-b249-65b3b93f989e.png)


### Steps to reproduce the problem

1. Go to Merge Checkpoints
2. Select 2 checkpoints
3. Save the merge one as ckpt
4. Run it


### What should have happened?

It should have create a new checkpoint merging both checkpoints

### Commit where the problem happens

https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/5ab7f213bec2f816f9c5644becb32eb72c8ffb89

### What platforms do you use to access the UI ?

Windows

### What browsers do you use to access the UI ?

Google Chrome

### Command Line Arguments

```Shell
--lowvram --precision full --no-half --skip-torch-cuda-test --xformers
```


### List of extensions

No

### Console logs

```Shell
Already up to date.
venv "F:\Users\meganano202\Desktop\ai\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: 5ab7f213bec2f816f9c5644becb32eb72c8ffb89
Installing requirements
Launching Web UI with arguments: --lowvram --precision full --no-half --skip-torch-cuda-test --xformers
Loading weights [3ecca4936a] from F:\Users\meganano202\Desktop\ai\stable-diffusion-webui\models\Stable-diffusion\darkSushi25D25D_v20.ckpt
Creating model from config: F:\Users\meganano202\Desktop\ai\stable-diffusion-webui\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Applying xformers cross attention optimization.
Textual inversion embeddings loaded(0):
Model loaded in 2.6s (load weights from disk: 1.7s, create model: 0.4s, apply weights to model: 0.5s).
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 12.2s (import torch: 2.6s, import gradio: 1.5s, import ldm: 0.9s, other imports: 1.4s, load scripts: 2.0s, load SD checkpoint: 2.7s, create ui: 0.7s, gradio launch: 0.1s).
Loading F:\Users\meganano202\Desktop\ai\stable-diffusion-webui\models\Stable-diffusion\darkSushi25D25D_v20.ckpt...
Loading F:\Users\meganano202\Desktop\ai\stable-diffusion-webui\models\Stable-diffusion\Sakimichan-ep25.ckpt...
Merging...
  2%|█▎                                                                              | 20/1215 [00:54<54:14,  2.72s/it]
Error loading/saving model file:
Traceback (most recent call last):
  File "F:\Users\meganano202\Desktop\ai\stable-diffusion-webui\modules\ui.py", line 1724, in modelmerger
    results = modules.extras.run_modelmerger(*args)
  File "F:\Users\meganano202\Desktop\ai\stable-diffusion-webui\modules\extras.py", line 197, in run_modelmerger
    assert a.shape[1] == 9 and b.shape[1] == 4, f"Bad dimensions for merged layer {key}: A={a.shape}, B={b.shape}"
AssertionError: Bad dimensions for merged layer model.diffusion_model.input_blocks.1.1.transformer_blocks.0.attn2.to_k.weight: A=torch.Size([320, 1024]), B=torch.Size([320, 768])
```


### Additional information

_No response_