Skip to content

Instantly share code, notes, and snippets.

@Kinsmir
Last active July 29, 2023 20:10
Show Gist options
  • Save Kinsmir/a8e99efd5ba6668cf71eb866399292b2 to your computer and use it in GitHub Desktop.
Save Kinsmir/a8e99efd5ba6668cf71eb866399292b2 to your computer and use it in GitHub Desktop.
AUTOMATIC1111 stable-diffusion-webui Installation on Apple Silicon (manual)

Installation on Apple Silicon (manual)

Homebrew

First, you need to install the required dependencies using Homebrew.

brew install cmake protobuf rust python git wget

Setting up Conda

Disclaimer: I wrote this guide with Conda due to environment variables saving. VENV will work for other installations but modify your environment accordingly.

# Download the conda installation file
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh

# Run the conda installation
`bash Miniconda3-latest-MacOSX-arm64.sh -b -p $HOME/miniconda`

# To make sure that conda is available in the $PATH.
export PATH="$HOME/miniconda/bin:$PATH"

# Initialize Conda
conda init

# (OPTIONAL) Disable conda automatic activation, since we don't need conda running all the time
conda config --set auto_activate_base false

# Create the conda environment 
conda create -n web-ui python=3.9

# Activate the conda environment
conda activate web-ui

Setting up the repository

# Clone the repository
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git

# Open the cloned repository
cd stable-diffusion-webui

# Install required base dependencies
pip install -r requirements.txt

# Missing dependency
pip install gdown 

## 
## Additional work around below is required at the moment of writing.
##

# There's a bug in protobuf that causes errors when generating images.
# Read: https://github.com/protocolbuffers/protobuf/issues/10571
# Once this gets fixed, we can remove this line
pip install protobuf==3.19.4

# Remove torch and all related packages
pip uninstall torch torchvision torchaudio -y

# Install the latest nightly build of PyTorch.
# Normally, we would install the latest nightly build of PyTorch here,
# But there's currently a performance regression in the latest nightly releases.
# Therefore, we're going to use this old version which doesn't have it.
#pip install --pre torch torchvision -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html --no-deps
pip install --pre torch==1.13.0.dev20220922 torchvision -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html --no-deps

# Activate the MPS_FALLBACK conda environment variable
conda env config vars set PYTORCH_ENABLE_MPS_FALLBACK=1

# Activate the COMMANDLINE_ARGS conda environment variable
conda env config vars set COMMANDLINE_ARGS="--skip-torch-cuda-test"

# We close down conda to activate the environment variables
conda deactivate

Setting up models

Place your downloaded model('s) in the following folder:
stable-diffusion-webui/models/Stable-diffusion/
No need to rename it or do anything else with them.

Running web-ui

# Activate conda if not active already
conda activate web-ui

# Startup the launcher
python launch.py --precision full --no-half --opt-split-attention-v1 

Updating repository

# Pull the latest changes from the repo
git pull --rebase
@Kinsmir
Copy link
Author

Kinsmir commented Oct 3, 2022

Lastest update 3-oct 16:56 CET:

Changed the python version from 3.10 to 3.9. According to this comment. This is also the version I am using myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment