Repository: stable-diffusion-webui
Issue: [Bug]: webui.sh crashes with `./webui.sh: line 255: 29175 Segmentation fault`
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?

The `webui` loading screen is shown in the browser, but loading never finishes. The process crashes in the terminal.

### Steps to reproduce the problem

1. join 'video' and 'render' groups
2. pull latest `stable-diffusion-webui`
3. manually make a `virtualenv`
4. install `pytorch` manually with `rocm` support using the command generated here: https://pytorch.org/
5. double-check by starting python and checking if `torch.cuda.is_available() == True`
6. run ./webui

### What should have happened?

webui should start successfully.

### Sysinfo

## ./webui.sh --dump-sysinfo

```
{
    "Platform": "Linux-5.15.0-89-generic-x86_64-with-glibc2.31",
    "Python": "3.10.10",
    "Version": "v1.6.1",
    "Commit": "4afaaf8a020c1df457bcf7250cb1c7f609699fa7",
    "Script path": "/home/user1/stadiff/stable-diffusion-webui",
    "Data path": "/home/user1/stadiff/stable-diffusion-webui",
    "Extensions dir": "/home/user1/stadiff/stable-diffusion-webui/extensions",
    "Checksum": "0357316d37e1317c23fff3a7d98544884023ea0fe221fe333f0399f9b8831fd2",
    "Commandline": [
        "launch.py",
        "--dump-sysinfo"
    ],
    "Torch env info": {
        "torch_version": "2.1.1+rocm5.6",
        "is_debug_build": "False",
        "cuda_compiled_version": "N/A",
        "gcc_version": "(Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0",
        "clang_version": null,
        "cmake_version": null,
        "os": "Ubuntu 20.04.6 LTS (x86_64)",
        "libc_version": "glibc-2.31",
        "python_version": "3.10.10 (main, Jul 20 2023, 22:20:53) [GCC 9.4.0] (64-bit runtime)",
        "python_platform": "Linux-5.15.0-89-generic-x86_64-with-glibc2.31",
        "is_cuda_available": "True",
        "cuda_runtime_version": null,
        "cuda_module_loading": "LAZY",
        "nvidia_driver_version": null,
        "nvidia_gpu_models": "AMD Radeon RX 7800 XT",
        "cudnn_version": null,
        "pip_version": "pip3",
        "pip_packages": [
            "numpy==1.23.5",
            "open-clip-torch==2.20.0",
            "pytorch-lightning==1.9.4",
            "pytorch-triton-rocm==2.1.0",
            "torch==2.1.1+rocm5.6",
            "torchaudio==2.1.1+rocm5.6",
            "torchdiffeq==0.2.3",
            "torchmetrics==1.2.1",
            "torchsde==0.2.5",
            "torchvision==0.16.1+rocm5.6"
        ],
        "conda_packages": null,
        "hip_compiled_version": "5.6.31061-8c743ae5d",
        "hip_runtime_version": "5.6.31061",
        "miopen_runtime_version": "2.20.0",
        "caching_allocator_config": "",
        "is_xnnpack_available": "True",
        "cpu_info": [
            "Architecture:                       x86_64",
            "CPU op-mode(s):                     32-bit, 64-bit",
            "Byte Order:                         Little Endian",
            "Address sizes:                      43 bits physical, 48 bits virtual",
            "CPU(s):                             12",
            "On-line CPU(s) list:                0-11",
            "Thread(s) per core:                 2",
            "Core(s) per socket:                 6",
            "Socket(s):                          1",
            "NUMA node(s):                       1",
            "Vendor ID:                          AuthenticAMD",
            "CPU family:                         23",
            "Model:                              113",
            "Model name:                         AMD Ryzen 5 3600 6-Core Processor",
            "Stepping:                           0",
            "Frequency boost:                    enabled",
            "CPU MHz:                            2200.000",
            "CPU max MHz:                        3600,0000",
            "CPU min MHz:                        2200,0000",
            "BogoMIPS:                           7200.54",
            "Virtualization:                     AMD-V",
            "L1d cache:                          192 KiB",
            "L1i cache:                          192 KiB",
            "L2 cache:                           3 MiB",
            "L3 cache:                           32 MiB",
            "NUMA node0 CPU(s):                  0-11",
            "Vulnerability Gather data sampling: Not affected",
            "Vulnerability Itlb multihit:        Not affected",
            "Vulnerability L1tf:                 Not affected",
            "Vulnerability Mds:                  Not affected",
            "Vulnerability Meltdown:             Not affected",
            "Vulnerability Mmio stale data:      Not affected",
            "Vulnerability Retbleed:             Mitigation; untrained return thunk; SMT enabled with STIBP protection",
            "Vulnerability Spec rstack overflow: Mitigation; safe RET",
            "Vulnerability Spec store bypass:    Mitigation; Speculative Store Bypass disabled via prctl and seccomp",
            "Vulnerability Spectre v1:           Mitigation; usercopy/swapgs barriers and __user pointer sanitization",
            "Vulnerability Spectre v2:           Mitigation; Retpolines, IBPB conditional, STIBP always-on, RSB filling, PBRSB-eIBRS Not affected",
            "Vulnerability Srbds:                Not affected",
            "Vulnerability Tsx async abort:      Not affected",
            "Flags:                              fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip rdpid overflow_recov succor smca sme sev sev_es"
        ]
    },
    "Exceptions": [],
    "CPU": {
        "model": "x86_64",
        "count logical": 12,
        "count physical": 6
    },
    "RAM": {
        "total": "31GB",
        "used": "4GB",
        "free": "7GB",
        "active": "2GB",
        "inactive": "20GB",
        "buffers": "263MB",
        "cached": "20GB",
        "shared": "114MB"
    },
    "Extensions": [],
    "Inactive extensions": [],
    "Environment": {
        "GIT": "git",
        "GRADIO_ANALYTICS_ENABLED": "False",
        "TORCH_COMMAND": "pip install torch==2.0.1+rocm5.4.2 torchvision==0.15.2+rocm5.4.2 --index-url https://download.pytorch.org/whl/rocm5.4.2"
    },
    "Config": "'NoneType' object has no attribute 'data'",
    "Startup": null,
    "Packages": [
        "absl-py==2.0.0",
        "accelerate==0.21.0",
        "addict==2.4.0",
        "aenum==3.1.15",
        "aiofiles==23.2.1",
        "aiohttp==3.9.1",
        "aiosignal==1.3.1",
        "altair==5.2.0",
        "antlr4-python3-runtime==4.9.3",
        "anyio==3.7.1",
        "async-timeout==4.0.3",
        "attrs==23.1.0",
        "basicsr==1.4.2",
        "beautifulsoup4==4.12.2",
        "blendmodes==2022",
        "boltons==23.1.1",
        "cachetools==5.3.2",
        "certifi==2022.12.7",
        "charset-normalizer==2.1.1",
        "clean-fid==0.1.35",
        "click==8.1.7",
        "clip==1.0",
        "contourpy==1.2.0",
        "cycler==0.12.1",
        "deprecation==2.1.0",
        "einops==0.4.1",
        "exceptiongroup==1.2.0",
        "facexlib==0.3.0",
        "fastapi==0.94.0",
        "ffmpy==0.3.1",
        "filelock==3.9.0",
        "filterpy==1.4.5",
        "fonttools==4.46.0",
        "frozenlist==1.4.0",
        "fsspec==2023.12.1",
        "ftfy==6.1.3",
        "future==0.18.3",
        "gdown==4.7.1",
        "gfpgan==1.3.8",
        "gitdb==4.0.11",
        "gitpython==3.1.32",
        "google-auth-oauthlib==1.1.0",
        "google-auth==2.25.1",
        "gradio-client==0.5.0",
        "gradio==3.41.2",
        "grpcio==1.60.0",
        "h11==0.12.0",
        "httpcore==0.15.0",
        "httpx==0.24.1",
        "huggingface-hub==0.19.4",
        "idna==3.4",
        "imageio==2.33.0",
        "importlib-metadata==7.0.0",
        "importlib-resources==6.1.1",
        "inflection==0.5.1",
        "jinja2==3.1.2",
        "jsonmerge==1.8.0",
        "jsonschema-specifications==2023.11.2",
        "jsonschema==4.20.0",
        "kiwisolver==1.4.5",
        "kornia==0.6.7",
        "lark==1.1.2",
        "lazy-loader==0.3",
        "lightning-utilities==0.10.0",
        "linkify-it-py==2.0.2",
        "llvmlite==0.41.1",
        "lmdb==1.4.1",
        "lpips==0.1.4",
        "markdown-it-py==2.2.0",
        "markdown==3.5.1",
        "markupsafe==2.1.3",
        "matplotlib==3.8.2",
        "mdit-py-plugins==0.3.3",
        "mdurl==0.1.2",
        "mpmath==1.3.0",
        "multidict==6.0.4",
        "networkx==3.0",
        "numba==0.58.1",
        "numpy==1.23.5",
        "oauthlib==3.2.2",
        "omegaconf==2.2.3",
        "open-clip-torch==2.20.0",
        "opencv-python==4.8.1.78",
        "orjson==3.9.10",
        "packaging==23.2",
        "pandas==2.1.4",
        "piexif==1.1.3",
        "pillow==9.5.0",
        "pip==22.3.1",
        "platformdirs==4.1.0",
        "protobuf==3.20.0",
        "psutil==5.9.5",
        "pyasn1-modules==0.3.0",
        "pyasn1==0.5.1",
        "pydantic==1.10.13",
        "pydub==0.25.1",
        "pygments==2.17.2",
        "pyparsing==3.1.1",
        "pysocks==1.7.1",
        "python-dateutil==2.8.2",
        "python-multipart==0.0.6",
        "pytorch-lightning==1.9.4",
        "pytorch-triton-rocm==2.1.0",
        "pytz==2023.3.post1",
        "pywavelets==1.5.0",
        "pyyaml==6.0.1",
        "realesrgan==0.3.0",
        "referencing==0.32.0",
        "regex==2023.10.3",
        "requests-oauthlib==1.3.1",
        "requests==2.28.1",
        "resize-right==0.0.2",
        "rpds-py==0.13.2",
        "rsa==4.9",
        "safetensors==0.3.1",
        "scikit-image==0.21.0",
        "scipy==1.11.4",
        "semantic-version==2.10.0",
        "sentencepiece==0.1.99",
        "setuptools==65.5.0",
        "six==1.16.0",
        "smmap==5.0.1",
        "sniffio==1.3.0",
        "soupsieve==2.5",
        "starlette==0.26.1",
        "sympy==1.12",
        "tb-nightly==2.16.0a20231208",
        "tensorboard-data-server==0.7.2",
        "tf-keras-nightly==2.16.0.dev2023120810",
        "tifffile==2023.9.26",
        "timm==0.9.2",
        "tokenizers==0.13.3",
        "tomesd==0.1.3",
        "tomli==2.0.1",
        "toolz==0.12.0",
        "torch==2.1.1+rocm5.6",
        "torchaudio==2.1.1+rocm5.6",
        "torchdiffeq==0.2.3",
        "torchmetrics==1.2.1",
        "torchsde==0.2.5",
        "torchvision==0.16.1+rocm5.6",
        "tqdm==4.66.1",
        "trampoline==0.1.2",
        "transformers==4.30.2",
        "typing-extensions==4.4.0",
        "tzdata==2023.3",
        "uc-micro-py==1.0.2",
        "urllib3==1.26.13",
        "uvicorn==0.24.0.post1",
        "wcwidth==0.2.12",
        "websockets==11.0.3",
        "werkzeug==3.0.1",
        "yapf==0.40.2",
        "yarl==1.9.4",
        "zipp==3.17.0"
    ]
}
```

## rocminfo

```
ROCk module is loaded
=====================    
HSA System Attributes    
=====================    
Runtime Version:         1.1
System Timestamp Freq.:  1000.000000MHz
Sig. Max Wait Duration:  18446744073709551615 (0xFFFFFFFFFFFFFFFF) (timestamp count)
Machine Model:           LARGE                              
System Endianness:       LITTLE                             
Mwaitx:                  DISABLED
DMAbuf Support:          YES

==========               
HSA Agents               
==========               
*******                  
Agent 1                  
*******                  
  Name:                    AMD Ryzen 5 3600 6-Core Processor  
  Uuid:                    CPU-XX                             
  Marketing Name:          AMD Ryzen 5 3600 6-Core Processor  
  Vendor Name:             CPU                                
  Feature:                 None specified                     
  Profile:                 FULL_PROFILE                       
  Float Round Mode:        NEAR                               
  Max Queue Number:        0(0x0)                             
  Queue Min Size:          0(0x0)                             
  Queue Max Size:          0(0x0)                             
  Queue Type:              MULTI                              
  Node:                    0                                  
  Device Type:             CPU                                
  Cache Info:              
    L1:                      32768(0x8000) KB                   
  Chip ID:                 0(0x0)                             
  ASIC Revision:           0(0x0)                             
  Cacheline Size:          64(0x40)                           
  Max Clock Freq. (MHz):   3600                               
  BDFID:                   0                                  
  Internal Node ID:        0                                  
  Compute Unit:            12                                 
  SIMDs per CU:            0                                  
  Shader Engines:          0                                  
  Shader Arrs. per Eng.:   0                                  
  WatchPts on Addr. Ranges:1                                  
  Features:                None
  Pool Info:               
    Pool 1                   
      Segment:                 GLOBAL; FLAGS: FINE GRAINED        
      Size:                    32781200(0x1f43390) KB             
      Allocatable:             TRUE                               
      Alloc Granule:           4KB                                
      Alloc Alignment:         4KB                                
      Accessible by all:       TRUE                               
    Pool 2                   
      Segment:                 GLOBAL; FLAGS: KERNARG, FINE GRAINED
      Size:                    32781200(0x1f43390) KB             
      Allocatable:             TRUE                               
      Alloc Granule:           4KB                                
      Alloc Alignment:         4KB                                
      Accessible by all:       TRUE                               
    Pool 3                   
      Segment:                 GLOBAL; FLAGS: COARSE GRAINED      
      Size:                    32781200(0x1f43390) KB             
      Allocatable:             TRUE                               
      Alloc Granule:           4KB                                
      Alloc Alignment:         4KB                                
      Accessible by all:       TRUE                               
  ISA Info:                
*******                  
Agent 2                  
*******                  
  Name:                    gfx1101                            
  Uuid:                    GPU-47ea4dc992bf103f               
  Marketing Name:          AMD Radeon RX 7800 XT              
  Vendor Name:             AMD                                
  Feature:                 KERNEL_DISPATCH                    
  Profile:                 BASE_PROFILE                       
  Float Round Mode:        NEAR                               
  Max Queue Number:        128(0x80)                          
  Queue Min Size:          64(0x40)                           
  Queue Max Size:          131072(0x20000)                    
  Queue Type:              MULTI                              
  Node:                    1                                  
  Device Type:             GPU                                
  Cache Info:              
    L1:                      32(0x20) KB                        
    L2:                      4096(0x1000) KB                    
    L3:                      65536(0x10000) KB                  
  Chip ID:                 29822(0x747e)                      
  ASIC Revision:           0(0x0)                             
  Cacheline Size:          64(0x40)                           
  Max Clock Freq. (MHz):   2254                               
  BDFID:                   11520                              
  Internal Node ID:        1                                  
  Compute Unit:            60                                 
  SIMDs per CU:            2                                  
  Shader Engines:          3                                  
  Shader Arrs. per Eng.:   2                                  
  WatchPts on Addr. Ranges:4                                  
  Features:                KERNEL_DISPATCH 
  Fast F16 Operation:      TRUE                               
  Wavefront Size:          32(0x20)                           
  Workgroup Max Size:      1024(0x400)                        
  Workgroup Max Size per Dimension:
    x                        1024(0x400)                        
    y                        1024(0x400)                        
    z                        1024(0x400)                        
  Max Waves Per CU:        32(0x20)                           
  Max Work-item Per CU:    1024(0x400)                        
  Grid Max Size:           4294967295(0xffffffff)             
  Grid Max Size per Dimension:
    x                        4294967295(0xffffffff)             
    y                        4294967295(0xffffffff)             
    z                        4294967295(0xffffffff)             
  Max fbarriers/Workgrp:   32                                 
  Packet Processor uCode:: 550                                
  SDMA engine uCode::      20                                 
  IOMMU Support::          None                               
  Pool Info:               
    Pool 1                   
      Segment:                 GLOBAL; FLAGS: COARSE GRAINED      
      Size:                    16760832(0xffc000) KB              
      Allocatable:             TRUE                               
      Alloc Granule:           4KB                                
      Alloc Alignment:         4KB                                
      Accessible by all:       FALSE                              
    Pool 2                   
      Segment:                 GLOBAL; FLAGS:                     
      Size:                    16760832(0xffc000) KB              
      Allocatable:             TRUE                               
      Alloc Granule:           4KB                                
      Alloc Alignment:         4KB                                
      Accessible by all:       FALSE                              
    Pool 3                   
      Segment:                 GROUP                              
      Size:                    64(0x40) KB                        
      Allocatable:             FALSE                              
      Alloc Granule:           0KB                                
      Alloc Alignment:         0KB                                
      Accessible by all:       FALSE                              
  ISA Info:                
    ISA 1                    
      Name:                    amdgcn-amd-amdhsa--gfx1101         
      Machine Models:          HSA_MACHINE_MODEL_LARGE            
      Profiles:                HSA_PROFILE_BASE                   
      Default Rounding Mode:   NEAR                               
      Default Rounding Mode:   NEAR                               
      Fast f16:                TRUE                               
      Workgroup Max Size:      1024(0x400)                        
      Workgroup Max Size per Dimension:
        x                        1024(0x400)                        
        y                        1024(0x400)                        
        z                        1024(0x400)                        
      Grid Max Size:           4294967295(0xffffffff)             
      Grid Max Size per Dimension:
        x                        4294967295(0xffffffff)             
        y                        4294967295(0xffffffff)             
        z                        4294967295(0xffffffff)             
      FBarrier Max Size:       32                                 
*** Done ***  
```


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

Mozilla Firefox

### Console logs

```Shell
################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
################################################################

################################################################
Running on user1 user
################################################################

################################################################
Repo already cloned, using it as install directory
################################################################

################################################################
python venv already activate or run without venv: /home/user1/.pyenv/versions/3.10.10/envs/stadiff
################################################################

################################################################
Launching launch.py...
################################################################
Using TCMalloc: libtcmalloc_minimal.so.4
Python 3.10.10 (main, Jul 20 2023, 22:20:53) [GCC 9.4.0]
Version: v1.6.1
Commit hash: 4afaaf8a020c1df457bcf7250cb1c7f609699fa7
Launching Web UI with arguments: 
no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
Loading weights [6ce0161689] from /home/maarten/stadiff/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Creating model from config: /home/maarten/stadiff/stable-diffusion-webui/configs/v1-inference.yaml
Startup time: 8.3s (prepare environment: 1.6s, import torch: 2.8s, import gradio: 0.9s, setup paths: 0.7s, other imports: 0.6s, load scripts: 0.6s, create ui: 0.4s, gradio launch: 0.6s).
./webui.sh: line 255: 29175 Segmentation fault      (core dumped) "${python_cmd}" -u "${LAUNCH_SCRIPT}" "$@"
```


### Additional information

Note that I replaced my username on my machine with `user1` in all copy-pasted output for privacy reasons.

I'm trying to run stable-diffusion-webui on an AMD graphics card, but I guess that's clear from the output above. Hope we can solve this. Thanks!