AbdBarho 4 лет назад
Родитель
Сommit
111825ac25

+ 0 - 0
.github/workflows/docker.yml → .github/workflows/docker.yml1


+ 0 - 22
.github/workflows/executable.yml1

@@ -1,22 +0,0 @@
-name: Check executable
-
-on: [push]
-
-jobs:
-  check:
-    runs-on: ubuntu-latest
-    name: Check all sh
-    steps:
-      - run: git config --global core.fileMode true
-      - uses: actions/checkout@v3
-      - shell: bash
-        run: |
-          shopt -s globstar;
-          FAIL=0
-          for file in **/*.sh; do
-              if [ -f "${file}" ] && [ -r "${file}" ] && [ ! -x "${file}" ]; then
-                  echo "$file" is not executable;
-                  FAIL=1
-              fi
-          done
-          exit ${FAIL}

+ 36 - 0
.github/workflows/xformers.yml

@@ -0,0 +1,36 @@
+name: Build Xformers
+
+on:
+  workflow_dispatch: {}
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    timeout-minutes: 180
+    container:
+      image: python:3.10-slim
+      env:
+        DEBIAN_FRONTEND: noninteractive
+        XFORMERS_DISABLE_FLASH_ATTN: 1
+        FORCE_CUDA: 1
+        TORCH_CUDA_ARCH_LIST: "6.0;6.1;6.2;7.0;7.2;7.5;8.0;8.6"
+        NVCC_FLAGS: --use_fast_math -DXFORMERS_MEM_EFF_ATTENTION_DISABLE_BACKWARD
+        MAX_JOBS: 4
+    steps:
+      - run: |
+          apt-get update
+          apt-get install gpg wget git -y
+          wget https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/cuda-keyring_1.0-1_all.deb
+          dpkg -i cuda-keyring_1.0-1_all.deb
+          apt-get update
+          apt-get install cuda-nvcc-11-8 cuda-libraries-dev-11-8 -y
+
+          export PIP_CACHE_DIR=$(pwd)/cache
+          pip install ninja install torch --extra-index-url https://download.pytorch.org/whl/cu113
+
+          pip wheel --wheel-dir=data git+https://github.com/facebookresearch/xformers.git@3633e1afc7bffbe61957f04e7bb1a742ee910ace#egg=xformers
+      - name: Artifacts
+        uses: actions/upload-artifact@v3
+        with:
+          name: xformers
+          path: data/xformers-0.0.14.dev0-cp310-cp310-linux_x86_64.whl

+ 1 - 1
docker-compose.yml

@@ -36,7 +36,7 @@ services:
     profiles: ["auto"]
     build: ./services/AUTOMATIC1111
     environment:
-      - CLI_ARGS=--allow-code --medvram
+      - CLI_ARGS=--allow-code --medvram --xformers
 
   auto-cpu:
     <<: *automatic

+ 6 - 1
services/AUTOMATIC1111/Dockerfile

@@ -20,6 +20,10 @@ EOF
 
 RUN git clone https://github.com/crowsonkb/k-diffusion.git repositories/k-diffusion && cd repositories/k-diffusion && git reset --hard f4e99857772fc3a126ba886aadf795a332774878
 
+FROM python:3.10-slim as xformers
+SHELL ["/bin/bash", "-ceuxo", "pipefail"]
+RUN pip install gdown
+RUN gdown https://drive.google.com/uc?id=1SqwicrLx1TrG_sbbEoIF_3TUHd4EYSmw -O /wheel.whl
 
 FROM python:3.10-slim
 
@@ -66,7 +70,8 @@ RUN pip install --prefer-binary --no-cache-dir opencv-python-headless \
   git+https://github.com/openai/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1 \
   pyngrok
 
-
+COPY --from=xformers /wheel.whl xformers-0.0.14.dev0-cp310-cp310-linux_x86_64.whl
+RUN pip install xformers-0.0.14.dev0-cp310-cp310-linux_x86_64.whl
 
 COPY . /docker
 RUN <<EOF