Skip to content

Instantly share code, notes, and snippets.

@zeldin
Last active October 15, 2023 20:13
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 zeldin/9f8281632c8792dff84dd5fee6d91ad8 to your computer and use it in GitHub Desktop.
Save zeldin/9f8281632c8792dff84dd5fee6d91ad8 to your computer and use it in GitHub Desktop.
Building stable-diffusion-webui on ppc64le
# This work is marked with CC0 1.0. To view a copy of this license,
# visit http://creativecommons.org/publicdomain/zero/1.0
ARG WEBUI_VERSION=1.5.2
ARG TORCH_VERSION=2.0.1
ARG VISION_VERSION=0.15.2
ARG MAX_JOBS=8
FROM debian:11 AS base
EXPOSE 7860
ENV LC_CTYPE=C.UTF-8
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get -y update && \
apt-get -y install --no-install-recommends \
wget ca-certificates git python-is-python3 python3-pip python3-dev \
python3-yaml python3-typing-extensions python3-numba python3-imageio \
libopenblas-dev libjpeg-dev libssl-dev libgl1 libglib2.0-0 \
gcc g++ gfortran make cmake patch pkg-config \
&& rm -rf /var/lib/apt/lists/*
FROM base as wheels
ARG TORCH_VERSION
ARG VISION_VERSION
ARG MAX_JOBS
WORKDIR /tmp
RUN git clone --progress --recursive --depth=1 -b v$TORCH_VERSION https://github.com/pytorch/pytorch pytorch
ADD https://github.com/pytorch/pytorch/files/11172185/fallback_cpu_kernel_VSX.patch pytorch/
WORKDIR pytorch
RUN patch -p1 <fallback_cpu_kernel_VSX.patch && echo $TORCH_VERSION > version.txt
RUN MAX_JOBS=$MAX_JOBS python3 setup.py bdist_wheel
RUN mkdir /tmp/wheels && cp dist/* /tmp/wheels/ && pip3 install dist/*.whl
WORKDIR /tmp
RUN git clone --progress --recursive --depth=1 -b v$VISION_VERSION https://github.com/pytorch/vision vision
WORKDIR vision
RUN echo $VISION_VERSION > version.txt
RUN python3 setup.py bdist_wheel
RUN cp dist/* /tmp/wheels/
FROM base
ARG WEBUI_VERSION
COPY --from=wheels /tmp/wheels/ /tmp/wheels/
RUN pip3 install /tmp/wheels/*.whl && rm -rf /tmp/wheels
WORKDIR /opt/stable-diffusion-webui
RUN git clone --progress --depth=1 -b v$WEBUI_VERSION https://github.com/AUTOMATIC1111/stable-diffusion-webui.git .
ADD https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors models/Stable-diffusion/
ENV ERROR_REPORTING=FALSE
ENV PIP_IGNORE_INSTALLED=0
ENV GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=true
ENV COMMANDLINE_ARGS="--use-cpu all --precision full --no-half --skip-torch-cuda-test --listen"
RUN python3 launch.py --exit
ENTRYPOINT ["python3", "launch.py"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment