Test 1 variables:
 - 3060 Ti
 - 20 steps
 - 7.5 cfg
 - euler_a
 - 4x 512x512

Test 1:
Without:
16.43, 15.98, 15.59 - About 49 seconds total for 3 runs.
With Xformers:
10.39, 10.22, 10.64 - About 30 seconds total for 3 runs.

About 1.6x faster with Xformers
--------------------
Test 2 variables:
 - 3060 Ti
 - 20 steps
 - 7.5 cfg
 - euler_a
 - 4x 1024x512

Test 1:
Without Xformers:
53.25, 54.23, 53.53 - About 2.6 minutes total for 3 runs.

With Xformers:
20.06, 20.42, 20.47 - About 1 minute total for 3 runs.

About 2.6x faster with Xformers!!
This commit is contained in:
PassiveLemon 2023-04-20 15:48:29 -04:00
parent 06bcba6958
commit 14f8df2f07

View file

@ -1,8 +1,12 @@
FROM python:3.10.9-slim FROM alpine:3.17 as xformers
RUN apk add --no-cache aria2
RUN aria2c -x 5 --dir / --out wheel.whl 'https://github.com/AbdBarho/stable-diffusion-webui-docker/releases/download/5.0.0/xformers-0.0.17.dev449-cp310-cp310-manylinux2014_x86_64.whl'
FROM python:3.10.10-slim
ENV DEBIAN_FRONTEND=noninteractive PIP_PREFER_BINARY=1 ENV DEBIAN_FRONTEND=noninteractive PIP_PREFER_BINARY=1
RUN --mount=type=cache,target=/root/.cache/pip pip install torch==1.13.0 torchvision --extra-index-url https://download.pytorch.org/whl/cu117 RUN --mount=type=cache,target=/root/.cache/pip pip install torch==1.13.1+cu117 torchvision --extra-index-url https://download.pytorch.org/whl/cu117
RUN apt-get update && apt-get install -y git && apt-get clean RUN apt-get update && apt-get install -y git && apt-get clean
@ -13,6 +17,10 @@ RUN --mount=type=cache,target=/root/.cache/pip \
git reset --hard 884ea653c8d6fe19b3724f45a04a0d74cd881f2f && \ git reset --hard 884ea653c8d6fe19b3724f45a04a0d74cd881f2f && \
pip install -r requirements.txt pip install -r requirements.txt
RUN --mount=type=cache,target=/root/.cache/pip \
--mount=type=bind,from=xformers,source=/wheel.whl,target=/xformers-0.0.15-cp310-cp310-linux_x86_64.whl \
pip install triton /xformers-0.0.15-cp310-cp310-linux_x86_64.whl
ARG BRANCH=master SHA=884ea653c8d6fe19b3724f45a04a0d74cd881f2f ARG BRANCH=master SHA=884ea653c8d6fe19b3724f45a04a0d74cd881f2f
RUN --mount=type=cache,target=/root/.cache/pip \ RUN --mount=type=cache,target=/root/.cache/pip \
cd stable-diffusion && \ cd stable-diffusion && \