Repository: stable-diffusion-webui
Issue: [Bug]: Docker breaks webui on AMD (with fix)
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?

A crash in lightining

### Steps to reproduce the problem

Run with docker instructions, there is a problem with pytorch-lightning and the webui breaks.

### What should have happened?

The webui should start.

### Commit where the problem happens

22bcc7be428c94e9408f589966c2040187245d81

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

Linux

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

_No response_

### Command Line Arguments

```Shell
TORCH_COMMAND='pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/rocm5.4.2' python launch.py
```


### List of extensions

No

### Console logs

```Shell
TORCH_COMMAND='pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/rocm5.1.1' python launch.py
Python 3.8.13 (default, Mar 28 2022, 11:38:47) 
[GCC 7.5.0]
Commit hash: 22bcc7be428c94e9408f589966c2040187245d81
Installing requirements for Web UI
Launching Web UI with arguments: 
No module 'xformers'. Proceeding without it.
==============================================================================
You are running torch 1.13.0.
The program is tested to work with torch 1.13.1.
To reinstall the desired version, run with commandline flag --reinstall-torch.
Beware that this will cause a lot of large files to be downloaded, as well as
there are reports of issues with training tab on the latest version.

Use --skip-version-check commandline argument to disable this check.
==============================================================================
Loading weights [6ce0161689] from /dockerx/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors
Creating model from config: /dockerx/stable-diffusion-webui/configs/v1-inference.yaml
Failed to create model quickly; will retry using slow method.
loading stable diffusion model: TypeError
Traceback (most recent call last):
  File "/dockerx/stable-diffusion-webui/webui.py", line 139, in initialize
    modules.sd_models.load_model()
  File "/dockerx/stable-diffusion-webui/modules/sd_models.py", line 438, in load_model
    sd_model = instantiate_from_config(sd_config.model)
  File "/dockerx/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/util.py", line 89, in instantiate_from_config
    return get_obj_from_str(config["target"])(**config.get("params", dict()))
  File "/dockerx/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/models/diffusion/ddpm.py", line 550, in __init__
    super().__init__(conditioning_key=conditioning_key, *args, **kwargs)
  File "/dockerx/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/models/diffusion/ddpm.py", line 81, in __init__
    super().__init__()
  File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/core/module.py", line 122, in __init__
    self._register_sharded_tensor_state_dict_hooks_if_available()
  File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/core/module.py", line 2022, in _register_sharded_tensor_state_dict_hooks_if_available
    self.__class__._register_load_state_dict_pre_hook(
  File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1467, in _register_load_state_dict_pre_hook
    self._load_state_dict_pre_hooks[handle.id] = _WrappedHook(hook, self if with_module else None)
  File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 54, in __init__
    self.module: weakref.ReferenceType["Module"] = weakref.ref(module)
TypeError: cannot create weak reference to 'weakcallableproxy' object


Stable diffusion model failed to load, exiting
```
```


### Additional information

The solution is to use rocm/pytorch:rocm5.1.1_ubuntu20.04_py3.7_pytorch_1.8.1 and update python to python 3.9 before running.