Repository: stable-diffusion-webui
Issue: [Bug]: Seg Fault with ROCM 7900 XT
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?

Fresh install on Ubuntu 22.04 goes well. However, when running webui shortly after HTTP server starts up (and launches a browser window that successfully loads from the server), the server crashes with the following error. I have tested this with ROCM 5.7, 6.0, and 6.0.1. I am running text-generation-webui successfully on the rocm device (so I think its not an overall system config issue) and the device is detected properly. I previously had a 6700 XT installed that was running stable-diffusion-webui well, but the new 7900 XT is not.

### Steps to reproduce the problem

1. Run ./webui.sh

### What should have happened?

WebUI should start up normally and load a model.

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

_No response_

### Sysinfo

[sysinfo-2024-01-25-23-06.json](https://github.com/AUTOMATIC1111/stable-diffusion-webui/files/14058498/sysinfo-2024-01-25-23-06.json)


### Console logs

```Shell
$ ./webui.sh 

################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye), Fedora 34+ and openSUSE Leap 15.4 or newer.
################################################################

################################################################
Running on xxx user
################################################################

################################################################
Repo already cloned, using it as install directory
################################################################

################################################################
Create and activate python venv
################################################################

################################################################
Launching launch.py...
################################################################
Using TCMalloc: libtcmalloc_minimal.so.4
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
Version: v1.7.0
Commit hash: cf2772fab0af5573da775e7437e6acdca424f26e
Launching Web UI with arguments: 
no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
Style database not found: /home/chase/Projects/stable-diffusion-webui/styles.csv
Loading weights [aeb7e9e689] from /home/chase/Projects/stable-diffusion-webui/models/Stable-diffusion/juggernautXL_v8Rundiffusion.safetensors
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 6.0s (prepare environment: 1.7s, import torch: 1.4s, import gradio: 0.5s, setup paths: 1.1s, other imports: 0.3s, load scripts: 0.3s, create ui: 0.3s, gradio launch: 0.3s).
Creating model from config: /home/chase/Projects/stable-diffusion-webui/repositories/generative-models/configs/inference/sd_xl_base.yaml
Calculating sha256 for /home/chase/Projects/stable-diffusion-webui/models/Stable-diffusion/realvisxlV30Turbo_v30TurboBakedvae.safetensors: cfab6aec061f4905db12c40dc43534a26b84d0a5c0085c428729fe36e3dc056c
Loading weights [cfab6aec06] from /home/chase/Projects/stable-diffusion-webui/models/Stable-diffusion/realvisxlV30Turbo_v30TurboBakedvae.safetensors
Creating model from config: /home/chase/Projects/stable-diffusion-webui/repositories/generative-models/configs/inference/sd_xl_base.yaml
changing setting sd_model_checkpoint to realvisxlV30Turbo_v30TurboBakedvae.safetensors: RuntimeError
Traceback (most recent call last):
  File "/home/chase/Projects/stable-diffusion-webui/modules/options.py", line 146, in set
    option.onchange()
  File "/home/chase/Projects/stable-diffusion-webui/modules/call_queue.py", line 13, in f
    res = func(*args, **kwargs)
  File "/home/chase/Projects/stable-diffusion-webui/modules/initialize_util.py", line 174, in <lambda>
    shared.opts.onchange("sd_model_checkpoint", wrap_queued_call(lambda: sd_models.reload_model_weights()), call=False)
  File "/home/chase/Projects/stable-diffusion-webui/modules/sd_models.py", line 783, in reload_model_weights
    load_model(checkpoint_info, already_loaded_state_dict=state_dict)
  File "/home/chase/Projects/stable-diffusion-webui/modules/sd_models.py", line 658, in load_model
    load_model_weights(sd_model, checkpoint_info, state_dict, timer)
  File "/home/chase/Projects/stable-diffusion-webui/modules/sd_models.py", line 375, in load_model_weights
    model.load_state_dict(state_dict, strict=False)
  File "/home/chase/Projects/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/chase/Projects/stable-diffusion-webui/modules/sd_disable_initialization.py", line 219, in load_state_dict
    state_dict = {k: v.to(device="meta", dtype=v.dtype) for k, v in state_dict.items()}
  File "/home/chase/Projects/stable-diffusion-webui/modules/sd_disable_initialization.py", line 219, in <dictcomp>
    state_dict = {k: v.to(device="meta", dtype=v.dtype) for k, v in state_dict.items()}
RuntimeError: dictionary changed size during iteration

./webui.sh: line 256:  5100 Segmentation fault      (core dumped) "${python_cmd}" -u "${LAUNCH_SCRIPT}" "$@"
```


### Additional information

_No response_