AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
141.53k stars 26.74k forks source link

[Bug]: Ubuntu 22.04 AMD Segmentation Fault #13435

Open Chilluminati91 opened 1 year ago

Chilluminati91 commented 1 year ago

Is there an existing issue for this?

What happened?

Ubuntu 22.04 LTS AMD RX 6650 XT

Had a stable running environment before I completely redid my Ubuntu setup. Clean install, running ROCM 5.4.2 to get max compatibility with PyTorch.

Now whenever I run the webui it ends in a segmentation fault. I've tried A LOT of different options and ROCM versions, redid my whole setup a bunch of times but it always ends like this. vladmandic's fork however runs fine.

Steps to reproduce the problem

  1. Setup Ubuntu 22.04
  2. Install amdgpu and rocm
  3. Clone automatic1111, create venv, install pytorch
  4. Run bash webui.sh
  5. Error

What should have happened?

Start like normal

Sysinfo

{ "Platform": "Linux-6.2.0-33-generic-x86_64-with-glibc2.35", "Python": "3.10.12", "Version": "v1.6.0", "Commit": "5ef669de080814067961f28357256e8fe27544f4", "Script path": "/home/liam/stable-diffusion-webui", "Data path": "/home/liam/stable-diffusion-webui", "Extensions dir": "/home/liam/stable-diffusion-webui/extensions", "Checksum": "6c05b491ae2b268acb2fbc8b526e39eb4416233f99280e8d480a7ec5b5339819", "Commandline": [ "launch.py", "--dump-sysinfo" ], "Torch env info": { "torch_version": "2.0.1+rocm5.4.2", "is_debug_build": "False", "cuda_compiled_version": "N/A", "gcc_version": "(Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0", "clang_version": null, "cmake_version": "version 3.25.0", "os": "Ubuntu 22.04.3 LTS (x86_64)", "libc_version": "glibc-2.35", "python_version": "3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] (64-bit runtime)", "python_platform": "Linux-6.2.0-33-generic-x86_64-with-glibc2.35", "is_cuda_available": "True", "cuda_runtime_version": null, "cuda_module_loading": "LAZY", "nvidia_driver_version": null, "nvidia_gpu_models": "AMD Radeon RX 6650 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.0.1", "torch==2.0.1+rocm5.4.2", "torchaudio==2.0.2+rocm5.4.2", "torchdiffeq==0.2.3", "torchmetrics==1.2.0", "torchsde==0.2.5", "torchvision==0.15.2+rocm5.4.2" ], "conda_packages": null, "hip_compiled_version": "5.4.22803-474e8620", "hip_runtime_version": "5.4.22803", "miopen_runtime_version": "2.19.0", "caching_allocator_config": "", "is_xnnpack_available": "True", "cpu_info": [ "Architecture: x86_64", "CPU op-mode(s): 32-bit, 64-bit", "Address sizes: 46 bits physical, 48 bits virtual", "Byte Order: Little Endian", "CPU(s): 16", "On-line CPU(s) list: 0-15", "Vendor ID: GenuineIntel", "Model name: 12th Gen Intel(R) Core(TM) i5-12600K", "CPU family: 6", "Model: 151", "Thread(s) per core: 2", "Core(s) per socket: 10", "Socket(s): 1", "Stepping: 2", "CPU max MHz: 4900,0000", "CPU min MHz: 800,0000", "BogoMIPS: 7372.80", "Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves split_lock_detect avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi umip pku ospke waitpkg gfni vaes vpclmulqdq tme rdpid movdiri movdir64b fsrm md_clear serialize pconfig arch_lbr ibt flush_l1d arch_capabilities", "Virtualization: VT-x", "L1d cache: 416 KiB (10 instances)", "L1i cache: 448 KiB (10 instances)", "L2 cache: 9,5 MiB (7 instances)", "L3 cache: 20 MiB (1 instance)", "NUMA node(s): 1", "NUMA node0 CPU(s): 0-15", "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: Not affected", "Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl", "Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization", "Vulnerability Spectre v2: Mitigation; Enhanced IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence", "Vulnerability Srbds: Not affected", "Vulnerability Tsx async abort: Not affected" ] }, "Exceptions": [], "CPU": { "model": "x86_64", "count logical": 16, "count physical": 10 }, "RAM": { "total": "31GB", "used": "9GB", "free": "291MB", "active": "8GB", "inactive": "22GB", "buffers": "192MB", "cached": "21GB", "shared": "856MB" }, "Extensions": [], "Inactive extensions": [], "Environment": { "GIT": "git", "GRADIO_ANALYTICS_ENABLED": "False" }, "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.8.5", "aiosignal==1.3.1", "altair==5.1.1", "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.0.0", "cachetools==5.3.1", "certifi==2022.12.7", "charset-normalizer==2.1.1", "clean-fid==0.1.35", "click==8.1.7", "clip==1.0", "cmake==3.25.0", "contourpy==1.1.1", "cycler==0.12.0", "deprecation==2.1.0", "einops==0.4.1", "exceptiongroup==1.1.3", "facexlib==0.3.0", "fastapi==0.94.0", "ffmpy==0.3.1", "filelock==3.9.0", "filterpy==1.4.5", "fonttools==4.42.1", "frozenlist==1.4.0", "fsspec==2023.9.2", "ftfy==6.1.1", "future==0.18.3", "gdown==4.7.1", "gfpgan==1.3.8", "gitdb==4.0.10", "gitpython==3.1.32", "google-auth-oauthlib==1.0.0", "google-auth==2.23.2", "gradio-client==0.5.0", "gradio==3.41.2", "grpcio==1.58.0", "h11==0.12.0", "httpcore==0.15.0", "httpx==0.24.1", "huggingface-hub==0.17.3", "idna==3.4", "imageio==2.31.4", "importlib-metadata==6.8.0", "importlib-resources==6.1.0", "inflection==0.5.1", "jinja2==3.1.2", "jsonmerge==1.8.0", "jsonschema-specifications==2023.7.1", "jsonschema==4.19.1", "kiwisolver==1.4.5", "kornia==0.6.7", "lark==1.1.2", "lazy-loader==0.3", "lightning-utilities==0.9.0", "lit==15.0.7", "llvmlite==0.41.0", "lmdb==1.4.1", "lpips==0.1.4", "markdown==3.4.4", "markupsafe==2.1.2", "matplotlib==3.8.0", "mpmath==1.3.0", "multidict==6.0.4", "networkx==3.0", "numba==0.58.0", "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.7", "packaging==23.1", "pandas==2.1.1", "piexif==1.1.3", "pillow==9.5.0", "pip==23.2.1", "platformdirs==3.10.0", "protobuf==3.20.0", "psutil==5.9.5", "pyasn1-modules==0.3.0", "pyasn1==0.5.0", "pydantic==1.10.13", "pydub==0.25.1", "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.0.1", "pytz==2023.3.post1", "pywavelets==1.4.1", "pyyaml==6.0.1", "realesrgan==0.3.0", "referencing==0.30.2", "regex==2023.8.8", "requests-oauthlib==1.3.1", "requests==2.28.1", "resize-right==0.0.2", "rpds-py==0.10.3", "rsa==4.9", "safetensors==0.3.1", "scikit-image==0.21.0", "scipy==1.11.3", "semantic-version==2.10.0", "sentencepiece==0.1.99", "setuptools==59.6.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.15.0a20230928", "tensorboard-data-server==0.7.1", "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.0.1+rocm5.4.2", "torchaudio==2.0.2+rocm5.4.2", "torchdiffeq==0.2.3", "torchmetrics==1.2.0", "torchsde==0.2.5", "torchvision==0.15.2+rocm5.4.2", "tqdm==4.66.1", "trampoline==0.1.2", "transformers==4.30.2", "typing-extensions==4.4.0", "tzdata==2023.3", "urllib3==1.26.13", "uvicorn==0.23.2", "wcwidth==0.2.7", "websockets==11.0.3", "werkzeug==2.3.7", "wheel==0.41.2", "yapf==0.40.2", "yarl==1.9.2", "zipp==3.17.0" ] }

What browsers do you use to access the UI ?

No response

Console logs

(venv) xxx@xxx-System-Product-Name:~/stable-diffusion-webui$ bash webui.sh

################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
################################################################

################################################################
Running on xxx user
################################################################

################################################################
Repo already cloned, using it as install directory
################################################################

################################################################
python venv already activate or run without venv: /home/xxx/stable-diffusion-webui/venv
################################################################

################################################################
Launching launch.py...
################################################################
Using TCMalloc: libtcmalloc_minimal.so.4
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]
Version: v1.6.0
Commit hash: 5ef669de080814067961f28357256e8fe27544f4
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/xxx/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/xxx/stable-diffusion-webui/configs/v1-inference.yaml
Startup time: 4.9s (prepare environment: 1.3s, import torch: 1.7s, import gradio: 0.4s, setup paths: 0.3s, other imports: 0.2s, load scripts: 0.2s, create ui: 0.3s, gradio launch: 0.3s).
webui.sh: line 255:  7018 Segmentation fault      (core dumped) "${python_cmd}" -u "${LAUNCH_SCRIPT}" "$@"

Additional information

No response

nktice commented 1 year ago

I too had issues getting everything working on AMD cards... so I wrote my own guide for what has worked for me - so I thought I'd share. https://github.com/nktice/AMD-AI

PennywiseDev commented 11 months ago

Try export HSA_OVERRIDE_GFX_VERSION=10.3.0

before you start ./webui.sh (or add this in ./webui-user.sh)