Skip to content

Instantly share code, notes, and snippets.

@VTRyo
Last active August 27, 2022 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VTRyo/8f4b45b13c7f88f961bb544ee419c2cb to your computer and use it in GitHub Desktop.
Save VTRyo/8f4b45b13c7f88f961bb544ee419c2cb to your computer and use it in GitHub Desktop.
Stable Diffusion

Prerequisite

  • Use apple silicon
  • MacBook Pro(14inch、2021)
    • Apple M1 Pro
    • 16GB
  • Signup haggingface

Setup run command

reference: https://zenn.dev/ktakayama/articles/6c627e0956f32c

$ brew install anaconda miniconda rust
$ conda init zsh
no change     /opt/homebrew/Caskroom/miniconda/base/condabin/conda
no change     /opt/homebrew/Caskroom/miniconda/base/bin/conda
no change     /opt/homebrew/Caskroom/miniconda/base/bin/conda-env
no change     /opt/homebrew/Caskroom/miniconda/base/bin/activate
no change     /opt/homebrew/Caskroom/miniconda/base/bin/deactivate
no change     /opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh
no change     /opt/homebrew/Caskroom/miniconda/base/etc/fish/conf.d/conda.fish
no change     /opt/homebrew/Caskroom/miniconda/base/shell/condabin/Conda.psm1
modified      /opt/homebrew/Caskroom/miniconda/base/shell/condabin/conda-hook.ps1
no change     /opt/homebrew/Caskroom/miniconda/base/lib/python3.9/site-packages/xontrib/conda.xsh
no change     /opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.csh
modified      /Users/vtryo/.zshrc

==> For changes to take effect, close and re-open your current shell. <==
$ git clone https://github.com/magnusviri/stable-diffusion.git && cd stable-diffusion
$ git checkout apple-silicon-support

You change library versions, if you needed.

$ vim environment-mac.yaml

Create conda environment in conda command.

$ conda env create -f environment-mac.yaml
Collecting package metadata (repodata.json): done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.12.0
  latest version: 4.14.0

Please update conda by running

    $ conda update -n base -c defaults conda



Downloading and Extracting Packages
sleef-3.5.1          | 363 KB    | ################### | 100%
libblas-3.9.0        | 13 KB     | ################### | 100%
tk-8.6.12            | 3.2 MB    | ################### | 100%

# ~continue log~

failed

CondaEnvException: Pip failed

↑ I think saw error log. but I could activate it.

$ conda activate ldm
(ldm) vtryo: ~/stable-diffusion (apple-silicon-mps-support *%=)

In order to handle big file, you install git-lfs.

$ brew install git-lfs
$ git lfs install

Clone repository.

cd .. && git clone https://huggingface.co/CompVis/stable-diffusion-v-1-4-original
Cloning into 'stable-diffusion-v-1-4-original'...
Username for 'https://huggingface.co': VTRyo
Password for 'https://VTRyo@huggingface.co':
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment