From 14f8df2f072034e4f0bb48d72cf6ce096a4b5d0c Mon Sep 17 00:00:00 2001 From: PassiveLemon Date: Thu, 20 Apr 2023 15:48:29 -0400 Subject: [PATCH] Xformers 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!! --- services/comfy/Dockerfile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/services/comfy/Dockerfile b/services/comfy/Dockerfile index 704729c..d9325ef 100644 --- a/services/comfy/Dockerfile +++ b/services/comfy/Dockerfile @@ -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 -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 @@ -13,6 +17,10 @@ RUN --mount=type=cache,target=/root/.cache/pip \ git reset --hard 884ea653c8d6fe19b3724f45a04a0d74cd881f2f && \ 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 RUN --mount=type=cache,target=/root/.cache/pip \ cd stable-diffusion && \