[Documentation] Updates on Docker platform

This commit is contained in:
Armando C. Santisbon 2022-09-11 15:57:32 -05:00
parent 585b47fdd1
commit 443a4ad87c

View File

@ -4,7 +4,7 @@ Table of Contents
* [Step 1 - Get the Model](#step-1---get-the-model)
* [Step 2 - Installation](#step-2---installation)
* [Option A - On a Linux container with Docker](#option-a---on-a-linux-container-with-docker-for-apple-silicon)
* [Option A - On a Linux container](#option-a---on-a-linux-container)
* [Prerequisites](#prerequisites)
* [Setup](#setup)
* [Option B - Directly on Apple silicon](#option-b---directly-on-apple-silicon)
@ -24,8 +24,9 @@ You'll need to create an account but it's quick and free.
# Step 2 - Installation
## Option A - On a Linux container
This example uses a Mac M2 but you can specify the platform and architecture as parameters when building the image and running the container.
You [can't access the Macbook M1/M2 GPU cores from the Docker containers](https://github.com/pytorch/pytorch/issues/81224) so performance is reduced but for development purposes it's fine.
This example uses a Mac M1/M2 (arm64) but you can specify the platform and architecture as parameters when building the image and running the container. It provides a reliable way to generate a build and deploy it. It also uses a Docker volume to store the largest model file as a first step in decoupling storage and compute. Future enhancements will do this for other model files and assets. The steps would be the same on an amd64 machine with NVIDIA GPUs as for an arm64 Mac; the platform is configurable.
You [can't access the Macbook M1/M2 GPU cores from the Docker containers](https://github.com/pytorch/pytorch/issues/81224) so performance is reduced compared with running it directly on macOS but for development purposes it's fine.
### Prerequisites
[Install Docker](https://gist.github.com/santisbon/2165fd1c9aaa1f7974f424535d3756f7#docker)
@ -62,7 +63,7 @@ wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh -O a
Build the Docker image. Give it any tag ```-t``` that you want.
Tip: Check that your shell session has the env variable set (above) with ```echo $GITHUB_STABLE_DIFFUSION```.
Base image will be arm64v8/debian on a macOS host.
```condaarch``` will restrict the conda environment to the right architecture when installing packages. It can take on: ```linux-64```, ```osx-64```, ```osx-arm64```. M1/M2 is ARM-based. On macOS you could also conda install ```nomkl``` but setting the environment appropriately is cleaner.
```condaarch``` will restrict the conda environment to the right architecture when installing packages. It can take on: ```linux-64```, ```osx-64```, ```osx-arm64```. On macOS you could also conda install ```nomkl``` but setting the environment appropriately is cleaner.
```Shell
docker build -t santisbon/stable-diffusion \
--platform linux/arm64 \