Repository: stable-diffusion-webui
Issue: [Bug]: OOM when trying to merge checkpoints
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?

When using latest version, "Your notebook tried to allocate more memory than is available.0" in either Kaggle or Colab notebook.
The last message in log is
Calculating sha256 for /kaggle/working/stable-diffusion-webui/models/Stable-diffusion/laoleiNewBerry_laoleiNewBerryProtogen.safetensors: 37cc33819f176cee3f2326129dc3a7066b26519a0c2d3fc33d4cd88e3e8d3f61

Tried with devices Tesla P100 (16GB VRAM) and T4. It happens not with every checkpoints but with most, even if both checkpoints less than 4GB. It was possible to merge same checkpoints with the webui in February, now it's not possible anymore and GPU session will crash.

### Steps to reproduce the problem

1. To reproduce the problem, use two checkpoints with webui such as Laolei Newberry and Kenshi
2. Go to merge tab in webui
3. Try to merge two models with any available options

### What should have happened?

The checkpoints should be merged normally instead, and it was possible a few months ago. Probably a bug?

### Commit where the problem happens

89f9faa63388756314e8a1d96cf86bf5e0663045

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

Linux, Other/Cloud

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

Mozilla Firefox, Google Chrome

### Command Line Arguments

```Shell
--deepdanbooru --share --disable-safe-unpickle --gradio-debug --gradio-auth foo:bar --config config.yaml --skip-torch-cuda-test
```


### List of extensions

sd-webui-additional-networks
sd-dynamic-prompts
stable-diffusion-webui-images-browser

### Console logs

```Shell
621.6s	133	Loading weights [4b0eec4da8] from /kaggle/working/stable-diffusion-webui/models/Stable-diffusion/kenshi_01.safetensors

623.8s	134	Creating model from config: /kaggle/working/stable-diffusion-webui/configs/v1-inference.yaml

623.8s	135	LatentDiffusion: Running in eps-prediction mode

624.9s	136	DiffusionWrapper has 859.52 M params.

625.3s	137	
Downloading (…)olve/main/vocab.json:   0%|           | 0.00/961k [00:00<?, ?B/s]
Downloading (…)olve/main/vocab.json: 100%|███| 961k/961k [00:00<00:00, 11.1MB/s]

626.1s	138	
Downloading (…)olve/main/merges.txt:   0%|           | 0.00/525k [00:00<?, ?B/s]
Downloading (…)olve/main/merges.txt: 100%|███| 525k/525k [00:00<00:00, 2.11MB/s]
Downloading (…)olve/main/merges.txt: 100%|███| 525k/525k [00:00<00:00, 2.10MB/s]

626.4s	139	
Downloading (…)cial_tokens_map.json:   0%|            | 0.00/389 [00:00<?, ?B/s]
Downloading (…)cial_tokens_map.json: 100%|██████| 389/389 [00:00<00:00, 353kB/s]

626.9s	140	
Downloading (…)okenizer_config.json:   0%|            | 0.00/905 [00:00<?, ?B/s]
Downloading (…)okenizer_config.json: 100%|██████| 905/905 [00:00<00:00, 809kB/s]

627.3s	141	
Downloading (…)lve/main/config.json:   0%|          | 0.00/4.52k [00:00<?, ?B/s]
Downloading (…)lve/main/config.json: 100%|█| 4.52k/4.52k [00:00<00:00, 4.03MB/s]

651.1s	142	Loading VAE weights from commandline argument: /kaggle/working/stable-diffusion-webui/models/VAE/model.vae.pt

654.0s	143	Applying cross attention optimization (Doggettx).

654.0s	144	Textual inversion embeddings loaded(0): 

654.0s	145	Model loaded in 79.7s (calculate hash: 47.3s, load weights from disk: 2.3s, create model: 3.9s, apply weights to model: 22.2s, apply half(): 1.3s, load VAE: 2.1s, move model to device: 0.6s).

937.8s	146	Loading /kaggle/working/stable-diffusion-webui/models/Stable-diffusion/laoleiNewBerry_laoleiNewBerryProtogen.safetensors...

941.2s	147	Loading /kaggle/working/stable-diffusion-webui/models/Stable-diffusion/kenshi_01.safetensors...

942.2s	148	Merging...\

1022.5s	150	Saving to /kaggle/working/stable-diffusion-webui/models/Stable-diffusion/0.5(kenshi_01) + 0.5(laoleiNewBerry_laoleiNewBerryProtogen).safetensors...

1060.9s	151	Calculating sha256 for /kaggle/working/stable-diffusion-webui/models/Stable-diffusion/laoleiNewBerry_laoleiNewBerryProtogen.safetensors: 37cc33819f176cee3f2326129dc3a7066b26519a0c2d3fc33d4cd88e3e8d3f61

Your notebook tried to allocate more memory than is available.0
```


### Additional information

_No response_