11# Must use a Cuda version 11+
2- FROM pytorch/pytorch:1.11.0-cuda11.3-cudnn8-devel as base
2+ # FROM pytorch/pytorch:1.11.0-cuda11.3-cudnn8-devel as base
3+ # xformers available precompiled for:
4+ # Python 3.9 or 3.10, CUDA 11.3 or 11.6, and PyTorch 1.12.1
5+ # https://github.com/facebookresearch/xformers/#getting-started
6+ FROM pytorch/pytorch:1.12.1-cuda11.3-cudnn8-runtime as base
7+ # FROM nvcr.io/nvidia/pytorch:22.08-py3 as base
38ENV DEBIAN_FRONTEND=noninteractive
49RUN mkdir -p /root/.cache/pip
510COPY root-cache/pip /root/.cache/pip
6- RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A4B469963BF863CC
11+ # RUN apt-get install gnupg2
12+ # RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A4B469963BF863CC
713RUN apt-get update && apt-get install -yqq git
814
15+ # RUN apt install -yqq software-properties-common
16+ # RUN add-apt-repository ppa:deadsnakes/ppa
17+ # RUN apt update
18+ # RUN apt-get install -yqq python3.10
19+ # RUN ln -sf /usr/bin/python3.10 /usr/bin/python3
20+ # RUN ln -sf /usr/bin/python3.10 /usr/bin/python
21+
922FROM base AS patchmatch
1023ARG USE_PATCHMATCH=0
1124WORKDIR /tmp
@@ -16,6 +29,16 @@ FROM base as output
1629RUN mkdir /api
1730WORKDIR /api
1831
32+ # We need python 3.9 or 3.10 for xformers
33+ # Yes, we install pytorch twice... will switch base image in future
34+ # RUN conda update -n base -c defaults conda
35+ RUN conda create -n xformers python=3.10
36+ SHELL ["conda" , "run" , "--no-capture-output" , "-n" , "xformers" , "/bin/bash" , "-c" ]
37+ RUN python --version
38+ RUN conda install -c pytorch -c conda-forge cudatoolkit=11.6 pytorch=1.12.1
39+ RUN conda install xformers -c xformers/label/dev
40+ RUN pip install triton==2.0.0.dev20221105
41+
1942# Install python packages
2043RUN pip3 install --upgrade pip
2144ADD requirements.txt requirements.txt
@@ -24,8 +47,9 @@ RUN pip3 install -r requirements.txt
2447# Required to build flash attention
2548# Turing: 7.5 (RTX 20s, Quadro), Ampere: 8.0 (A100), 8.6 (RTX 30s)
2649# https://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards/
27- ENV FLASH_ATTENTION=0
28- ENV TORCH_CUDA_ARCH_LIST="7.5 8.0 8.6"
50+ # ENV FLASH_ATTENTION=0
51+ # ENV TORCH_CUDA_ARCH_LIST="7.5 8.0 8.6"
52+ # this is built it into memory efficient attention now ! ^_^
2953
3054ADD install.sh .
3155RUN bash install.sh
@@ -83,3 +107,4 @@ ADD send.py .
83107ADD app.py .
84108
85109CMD python3 -u server.py
110+
0 commit comments