stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: Segmentation Fault in webui.py on M1 Mac

Open rworne opened this issue 2 years ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

What happened?

Segmentation faults on M1 mac in webui.py.

When doing a fresh install, webui.py may or may not start up correctly. When it fails (as it does most of the time) it gets a segmentation fault:

Warning: caught exception 'Torch not compiled with CUDA enabled', memory monitor disabled No module 'xformers'. Proceeding without it. LatentDiffusion: Running in eps-prediction mode DiffusionWrapper has 859.52 M params. Loading weights [6b508e59] from /Volumes/Mac Data SSD/Developer/stable-diffusion-webui/models/Stable-diffusion/Elysium_Anime_V2.ckpt Loading VAE weights from: /Volumes/Mac Data SSD/Developer/stable-diffusion-webui/models/VAE/kl-f8-anime2.ckpt ./run_webui_mac.sh: line 15: 4213 Segmentation fault: 11 python webui.py --precision full --no-half --use-cpu Interrogate GFPGAN CodeFormer $@

Steps to reproduce the problem

  1. Install Automatic1111
  2. Copy your models back in
  3. Start the WebUI
  4. Exit app
  5. Start WebUI again

On the first run it usually will run OK. Afterwards, when exiting and restarting it will stubbornly get segmentation faults - nondeterministically. Sometimes no, but most of the time yes. To get it working again, I need to nuke it and reinstall.

What should have happened?

Should run without crashing. Stability has gone down a lot over the past few weeks.

Commit where the problem happens

0b5dcb3

What platforms do you use to access UI ?

MacOS

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

python webui.py --precision full --no-half --use-cpu Interrogate GFPGAN CodeFormer $@

Additional information, context and logs

As you can see from the log below, it successfully ran once (as the default model has changed). It refuses to run a second time.

Robert@Mac-Studio stable-diffusion-webui % ./run_webui_mac.sh
To make your changes take effect please reactivate your environment
WARNING: overwriting environment variables set in the machine
overwriting variable {'PYTORCH_ENABLE_MPS_FALLBACK'}
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 10 (delta 6), reused 6 (delta 6), pack-reused 0
Unpacking objects: 100% (10/10), 5.28 KiB | 676.00 KiB/s, done.
From https://github.com/AUTOMATIC1111/stable-diffusion-webui
   bb11bee..0b5dcb3  master     -> origin/master
Updating bb11bee..0b5dcb3
Fast-forward
 modules/call_queue.py | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++
 modules/sd_models.py  |  4 +--
 modules/ui.py         | 67 ++---------------------------------
 webui.py              | 30 ++--------------
 4 files changed, 106 insertions(+), 93 deletions(-)
 create mode 100644 modules/call_queue.py
Warning: caught exception 'Torch not compiled with CUDA enabled', memory monitor disabled
No module 'xformers'. Proceeding without it.
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Loading weights [6b508e59] from /Volumes/Mac Data SSD/Developer/stable-diffusion-webui/models/Stable-diffusion/Elysium_Anime_V2.ckpt
Loading VAE weights from: /Volumes/Mac Data SSD/Developer/stable-diffusion-webui/models/VAE/kl-f8-anime2.ckpt
./run_webui_mac.sh: line 15:  4213 Segmentation fault: 11  python webui.py --precision full --no-half --use-cpu Interrogate GFPGAN CodeFormer $@

Adding: pip install -r requirements.txt to the startup script tends to bring it back (cut for brevity):

Installing collected packages: fairscale, timm, pytorch_lightning
  Attempting uninstall: fairscale
    Found existing installation: fairscale 0.4.9
    Uninstalling fairscale-0.4.9:
      Successfully uninstalled fairscale-0.4.9
  Attempting uninstall: timm
    Found existing installation: timm 0.6.7
    Uninstalling timm-0.6.7:
      Successfully uninstalled timm-0.6.7
  Attempting uninstall: pytorch_lightning
    Found existing installation: pytorch-lightning 1.7.6
    Uninstalling pytorch-lightning-1.7.6:
      Successfully uninstalled pytorch-lightning-1.7.6
Successfully installed fairscale-0.4.4 pytorch_lightning-1.7.7 timm-0.4.12
Warning: caught exception 'Torch not compiled with CUDA enabled', memory monitor disabled
No module 'xformers'. Proceeding without it.
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Loading weights [6b508e59] from /Volumes/Mac Data SSD/Developer/stable-diffusion-webui/models/Stable-diffusion/Elysium_Anime_V2.ckpt
Loading VAE weights from: /Volumes/Mac Data SSD/Developer/stable-diffusion-webui/models/VAE/kl-f8-anime2.ckpt
Applying cross attention optimization (InvokeAI).
Model loaded.
Loaded a total of 0 textual inversion embeddings.
Embeddings: 
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.

rworne avatar Nov 28 '22 15:11 rworne