mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
upgrade INSTALL_MAC.md:
- use annotations and content-tabs yes, this looks ugly in repo afterwards, but plz also look at mkdocs: https://mauwii.github.io/stable-diffusion/installation/INSTALL_MAC/
This commit is contained in:
parent
8f6c544480
commit
2c6a6a567f
@ -3,6 +3,7 @@ title: macOS
|
|||||||
---
|
---
|
||||||
|
|
||||||
# :fontawesome-brands-apple: macOS
|
# :fontawesome-brands-apple: macOS
|
||||||
|
|
||||||
Invoke AI runs quite well on M1 Macs and we have a number of M1 users
|
Invoke AI runs quite well on M1 Macs and we have a number of M1 users
|
||||||
in the community.
|
in the community.
|
||||||
|
|
||||||
@ -27,98 +28,120 @@ First you need to download a large checkpoint file.
|
|||||||
|
|
||||||
While that is downloading, open Terminal and run the following commands one at a time, reading the comments and taking care to run the appropriate command for your Mac's architecture (Intel or M1).
|
While that is downloading, open Terminal and run the following commands one at a time, reading the comments and taking care to run the appropriate command for your Mac's architecture (Intel or M1).
|
||||||
|
|
||||||
Do not just copy and paste the whole thing into your terminal!
|
!!! todo "Homebrew"
|
||||||
|
|
||||||
```bash
|
If you have no brew installation yet (otherwise skip):
|
||||||
# Install brew (and Xcode command line tools):
|
|
||||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
|
||||||
|
|
||||||
# Now there are two options to get the Python (miniconda) environment up and running:
|
```bash title="install brew (and Xcode command line tools)"
|
||||||
# 1. Alongside pyenv
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||||
# 2. Standalone
|
```
|
||||||
#
|
|
||||||
# If you don't know what we are talking about, choose 2.
|
|
||||||
#
|
|
||||||
# If you are familiar with python environments, you'll know there are other options
|
|
||||||
# for setting up the environment - you are on your own if you go one of those routes.
|
|
||||||
|
|
||||||
##### BEGIN TWO DIFFERENT OPTIONS #####
|
!!! todo "Conda Installation"
|
||||||
|
|
||||||
### BEGIN OPTION 1: Installing alongside pyenv ###
|
Now there are two different ways to set up the Python (miniconda) environment:
|
||||||
brew install pyenv-virtualenv # you might have this from before, no problem
|
|
||||||
pyenv install anaconda3-2022.05
|
|
||||||
pyenv virtualenv anaconda3-2022.05
|
|
||||||
eval "$(pyenv init -)"
|
|
||||||
pyenv activate anaconda3-2022.05
|
|
||||||
### END OPTION 1 ###
|
|
||||||
|
|
||||||
### BEGIN OPTION 2: Installing standalone ###
|
1. Standalone
|
||||||
# Install cmake, protobuf, and rust:
|
2. with pyenv
|
||||||
brew install cmake protobuf rust
|
|
||||||
|
|
||||||
# BEGIN ARCHITECTURE-DEPENDENT STEP #
|
If you don't know what we are talking about, choose Standalone. If you are familiar with python environments, choose "with pyenv"
|
||||||
# For M1: 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
|
|
||||||
|
|
||||||
# For Intel: install miniconda (Intel x86-64 version):
|
=== "Standalone"
|
||||||
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o Miniconda3-latest-MacOSX-x86_64.sh
|
|
||||||
/bin/bash Miniconda3-latest-MacOSX-x86_64.sh
|
|
||||||
# END ARCHITECTURE-DEPENDENT STEP #
|
|
||||||
|
|
||||||
### END OPTION 2 ###
|
```bash title="Install cmake, protobuf, and rust"
|
||||||
|
brew install cmake protobuf rust
|
||||||
|
```
|
||||||
|
|
||||||
##### END TWO DIFFERENT OPTIONS #####
|
Then choose the kind of your Mac and install miniconda:
|
||||||
|
|
||||||
# Clone the Invoke AI repo
|
=== "M1 arm64"
|
||||||
git clone https://github.com/invoke-ai/InvokeAI.git
|
|
||||||
cd InvokeAI
|
|
||||||
|
|
||||||
### WAIT FOR THE CHECKPOINT FILE TO DOWNLOAD, THEN PROCEED ###
|
```bash title="Install miniconda for M1 arm64"
|
||||||
|
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh \
|
||||||
|
-o Miniconda3-latest-MacOSX-arm64.sh
|
||||||
|
/bin/bash Miniconda3-latest-MacOSX-arm64.sh
|
||||||
|
```
|
||||||
|
|
||||||
# We will leave the big checkpoint wherever you stashed it for long-term storage,
|
=== "Intel x86_64"
|
||||||
# and make a link to it from the repo's folder. This allows you to use it for
|
|
||||||
# other repos, and if you need to delete Invoke AI, you won't have to download it again.
|
|
||||||
|
|
||||||
# Make the directory in the repo for the symlink
|
```bash title="Install miniconda for Intel"
|
||||||
mkdir -p models/ldm/stable-diffusion-v1/
|
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh \
|
||||||
|
-o Miniconda3-latest-MacOSX-x86_64.sh
|
||||||
|
/bin/bash Miniconda3-latest-MacOSX-x86_64.sh
|
||||||
|
```
|
||||||
|
|
||||||
# This is the folder where you put the checkpoint file `sd-v1-4.ckpt`
|
=== "with pyenv"
|
||||||
PATH_TO_CKPT="$HOME/Downloads"
|
|
||||||
|
|
||||||
# Create a link to the checkpoint
|
```bash
|
||||||
ln -s "$PATH_TO_CKPT/sd-v1-4.ckpt" models/ldm/stable-diffusion-v1/model.ckpt
|
brew install pyenv-virtualenv
|
||||||
|
pyenv install anaconda3-2022.05
|
||||||
|
pyenv virtualenv anaconda3-2022.05
|
||||||
|
eval "$(pyenv init -)"
|
||||||
|
pyenv activate anaconda3-2022.05
|
||||||
|
```
|
||||||
|
|
||||||
# BEGIN ARCHITECTURE-DEPENDENT STEP #
|
!!! todo "Clone the Invoke AI repo"
|
||||||
# For M1: Create the environment & install packages
|
|
||||||
PIP_EXISTS_ACTION=w CONDA_SUBDIR=osx-arm64 conda env create -f environment-mac.yml
|
|
||||||
|
|
||||||
# For Intel: Create the environment & install packages
|
```bash
|
||||||
PIP_EXISTS_ACTION=w CONDA_SUBDIR=osx-64 conda env create -f environment-mac.yml
|
git clone https://github.com/invoke-ai/InvokeAI.git
|
||||||
|
cd InvokeAI
|
||||||
|
```
|
||||||
|
|
||||||
# END ARCHITECTURE-DEPENDENT STEP #
|
!!! todo "Wait until the checkpoint-file download finished, then proceed"
|
||||||
|
|
||||||
# Activate the environment (you need to do this every time you want to run SD)
|
We will leave the big checkpoint wherever you stashed it for long-term storage,
|
||||||
conda activate invokeai
|
and make a link to it from the repo's folder. This allows you to use it for
|
||||||
|
other repos, or if you need to delete Invoke AI, you won't have to download it again.
|
||||||
|
|
||||||
# This will download some bits and pieces and make take a while
|
```{.bash .annotate}
|
||||||
python scripts/preload_models.py
|
# Make the directory in the repo for the symlink
|
||||||
|
mkdir -p models/ldm/stable-diffusion-v1/
|
||||||
|
|
||||||
# Run SD!
|
# This is the folder where you put the checkpoint file `sd-v1-4.ckpt`
|
||||||
python scripts/dream.py
|
PATH_TO_CKPT="$HOME/Downloads" # (1)!
|
||||||
```
|
|
||||||
# or run the web interface!
|
|
||||||
python scripts/invoke.py --web
|
|
||||||
|
|
||||||
# The original scripts should work as well.
|
# Create a link to the checkpoint
|
||||||
python scripts/orig_scripts/txt2img.py \
|
ln -s "$PATH_TO_CKPT/sd-v1-4.ckpt" models/ldm/stable-diffusion-v1/model.ckpt
|
||||||
--prompt "a photograph of an astronaut riding a horse" \
|
```
|
||||||
--plms
|
|
||||||
```
|
|
||||||
|
|
||||||
Note, `export PIP_EXISTS_ACTION=w` is a precaution to fix `conda env
|
1. replace `$HOME/Downloads` with the Location where you actually stored the Checkppoint (`sd-v1-4.ckpt`)
|
||||||
create -f environment-mac.yml` never finishing in some situations. So
|
|
||||||
it isn't required but wont hurt.
|
!!! todo "Create the environment & install packages"
|
||||||
|
|
||||||
|
=== "M1 Mac"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
PIP_EXISTS_ACTION=w CONDA_SUBDIR=osx-arm64 conda env create -f environment-mac.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "Intel x86_64 Mac"
|
||||||
|
|
||||||
|
```bash
|
||||||
|
PIP_EXISTS_ACTION=w CONDA_SUBDIR=osx-64 conda env create -f environment-mac.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Activate the environment (you need to do this every time you want to run SD)
|
||||||
|
conda activate invokeai
|
||||||
|
|
||||||
|
# This will download some bits and pieces and make take a while
|
||||||
|
python scripts/preload_models.py
|
||||||
|
|
||||||
|
# Run SD!
|
||||||
|
python scripts/dream.py
|
||||||
|
|
||||||
|
# or run the web interface!
|
||||||
|
python scripts/invoke.py --web
|
||||||
|
|
||||||
|
# The original scripts should work as well.
|
||||||
|
python scripts/orig_scripts/txt2img.py \
|
||||||
|
--prompt "a photograph of an astronaut riding a horse" \
|
||||||
|
--plms
|
||||||
|
```
|
||||||
|
!!! info
|
||||||
|
|
||||||
|
`export PIP_EXISTS_ACTION=w` is a precaution to fix `conda env
|
||||||
|
create -f environment-mac.yml` never finishing in some situations. So
|
||||||
|
it isn't required but wont hurt.
|
||||||
---
|
---
|
||||||
|
|
||||||
## Common problems
|
## Common problems
|
||||||
@ -158,7 +181,6 @@ conda install \
|
|||||||
-n ldm
|
-n ldm
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
If it takes forever to run `conda env create -f environment-mac.yml`, try this:
|
If it takes forever to run `conda env create -f environment-mac.yml`, try this:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -170,12 +192,12 @@ conda clean \
|
|||||||
|
|
||||||
Or you could try to completley reset Anaconda:
|
Or you could try to completley reset Anaconda:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
conda update \
|
conda update \
|
||||||
--force-reinstall \
|
--force-reinstall \
|
||||||
-y \
|
-y \
|
||||||
-n base \
|
-n base \
|
||||||
-c defaults conda
|
-c defaults conda
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
Loading…
x
Reference in New Issue
Block a user