Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the macos README is lacking a lot of steps #315

Closed
slk333 opened this issue Sep 2, 2022 · 6 comments
Closed

the macos README is lacking a lot of steps #315

slk333 opened this issue Sep 2, 2022 · 6 comments

Comments

@slk333
Copy link

slk333 commented Sep 2, 2022

the macos README is basically a "go figure yourself", it really needs more work. It does not mention the following things, which are yet obviously required

  • Installing Python
  • Downloading the weights
  • Installing Anaconda
  • Installing protobuff rust

https://github.com/lstein/stable-diffusion/blob/main/README-Mac-MPS.md

Also, there is no explanation on how to install GFPGAN and realESRGAN

@user799595
Copy link

Some more instructions here: https://news.ycombinator.com/item?id=32680385

@psychedelicious
Copy link
Collaborator

Here is a rough draft, I've tried to make it very clear and take you from a fresh macOS install to having SD running.

M1 Mac Installation

First get the weights checkpoint download started - it's big:

  1. Sign up at https://huggingface.co
  2. Accept the terms and click Access Repository: https://huggingface.co/CompVis/stable-diffusion-v-1-4-original
  3. Download sd-v1-4.ckpt (4.27 GB) and note where you have saved it (probably the Downloads folder)

While that is downloading, open Terminal and run the following commands one at a time.

# install Xcode command line tools
xcode-select --install

# install brew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# install python 3, git, cmake, protobuf:
brew install python git cmake protobuf

# install miniconda (M1 arm64 version):
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh -o Miniconda3-latest-MacOSX-arm64.sh
/bin/bash Miniconda3-latest-MacOSX-arm64.sh

# install rust:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# clone the repo
git clone https://github.com/lstein/stable-diffusion.git
cd stable-diffusion

#
# wait until the checkpoint file has downloaded, then proceed
#

# create symlink to checkpoint
mkdir -p models/ldm/stable-diffusion-v1/
PATH_TO_CKPT="$HOME/Downloads"  # or wherever you saved sd-v1-4.ckpt
ln -s "$PATH_TO_CKPT/sd-v1-4.ckpt" models/ldm/stable-diffusion-v1/model.ckpt

# install packages
PIP_EXISTS_ACTION=w CONDA_SUBDIR=osx-arm64 conda env create -f environment-mac.yaml

# only need to do this once
python scripts/preload_models.py

# run SD!
python scripts/dream.py --full_precision  # half-precision requires autocast and won't work

@magnusviri
Copy link
Contributor

magnusviri commented Sep 2, 2022

@psychedelicious I like your instructions. Notes: you shouldn't need to brew install python git for this to work. Xcode includes both and these instructions don't use that version of python anyway. In fact, the instructions coudl be simplified by not doing the xcode-select because brew will install the command line tools also. Some people might prefer to install rust with brew. Is there a reason you are using their install script instead of brew? You also left out conda activate ldm. I'm working to incorporate your changes to the pull request I just made.

@psychedelicious
Copy link
Collaborator

@magnusviri Trust your judgement in including/amending any of what I wrote.

No reason for installing rust via script; it's just how I remembered installing it. Especially for less technical people, installing everything possible using brew sounds like a good idea - if something goes awry it's easier to fix stuff using a package manager!

@Beach77
Copy link

Beach77 commented Sep 3, 2022

create symlink to checkpoint

mkdir -p models/ldm/stable-diffusion-v1/
PATH_TO_CKPT="$HOME/Downloads" # or wherever you saved sd-v1-4.ckpt
ln -s "$PATH_TO_CKPT/sd-v1-4.ckpt" models/ldm/stable-diffusion-v1/model.ckpt

Wow the original README wasted so much of my time, so evil. Thanks for making this. But there is still one place I don't understand which is the quoted part which I'll manage to figure out soon enough but could be helpful for others if it's made a little easier to understand.

EDIT: Managed to figure it out but don't remember how. No need for the thumbs down user799595 just because someone doesn't know how to figure out badly written instructions.

@user799595
Copy link

user799595 commented Sep 3, 2022

Slightly off-topic, but does anyone know the difference between these two files:
sd-v1-4.ckpt
sd-v1-4-full-ema.ckpt
I think the latter means "full Exponential Moving Average", which is a style of training apparently. This latter model is also about 2x the size.

Is one better than the other for inference?

@slk333 slk333 closed this as completed Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants