-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
108 lines (90 loc) · 3.7 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
FROM rocm/pytorch:rocm5.7_ubuntu22.04_py3.10_pytorch_2.0.1
ENV PORT=8188 \
COMMANDLINE_ARGS='' \
### how many CPUCores are using while compiling
MAX_JOBS=14 \
### Settings for AMD GPU RX570/RX580/RX590 GPU
HSA_OVERRIDE_GFX_VERSION=8.0.3 \
PYTORCH_ROCM_ARCH=gfx803 \
ROCM_ARCH=gfx803 \
TORCH_BLAS_PREFER_HIPBLASLT=0\
ROC_ENABLE_PRE_VEGA=1 \
USE_CUDA=0 \
USE_ROCM=1 \
USE_NINJA=1 \
FORCE_CUDA=1 \
#######
DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \
PYTHONENCODING=UTF-8\
REQS_FILE='requirements.txt' \
COMMANDLINE_ARGS=''
## Write the Environment VARSs to global... to compile later with while you use #docker save# or #docker commit#
RUN echo MAX_JOBS=${MAX_JOBS} >> /etc/environment && \
echo HSA_OVERRIDE_GFX_VERSION=${HSA_OVERRIDE_GFX_VERSION} >> /etc/environment && \
echo PYTORCH_ROCM_ARCH=${PYTORCH_ROCM_ARCH} >> /etc/environment && \
echo ROCM_ARCH=${ROCM_ARCH} >> /etc/environment && \
echo TORCH_BLAS_PREFER_HIPBLASLT=${TORCH_BLAS_PREFER_HIPBLASLT} >> /etc/environment && \
echo ROC_ENABLE_PRE_VEGA=${ROC_ENABLE_PRE_VEGA} >> /etc/environment && \
echo USE_CUDA=${USE_CUDA} >> /etc/environment && \
echo USE_ROCM=${USE_ROCM} >> /etc/environment && \
echo USE_NINJA=${USE_NINJA} >> /etc/environment && \
echo FORCE_CUDA=${FORCE_CUDA} >> /etc/environment && \
true
## Export the AMD Stuff
RUN export MAX_JOBS=${MAX_JOBS} && \
export HSA_OVERRIDE_GFX_VERSION=${HSA_OVERRIDE_GFX_VERSION} && \
export ROC_ENABLE_PRE_VEGA=${ROC_ENABLE_PRE_VEGA} && \
export PYTORCH_ROCM_ARCH=${PYTORCH_ROCM_ARCH} && \
export ROCM_ARCH=${ROCM_ARCH} && \
export TORCH_BLAS_PREFER_HIPBLASLT=${TORCH_BLAS_PREFER_HIPBLASLT} && \
export USE_CUDA=${USE_CUDA} && \
export USE_ROCM=${USE_ROCM} && \
export USE_NINJA=${USE_NINJA} && \
export FORCE_CUDA=${FORCE_CUDA} && \
true
# Update System and install ffmpeg for SDXL video and python virtual Env
RUN apt-get -y update && \
apt-get install -y --no-install-recommends ffmpeg virtualenv google-perftools tmux mc pigz && \
pip install --upgrade pip wheel && \
pip install cmake mkl mkl-include && \
true
# git clone PyTorch Version you need for
### PyTorch Version
ENV PYTORCH_GIT_VERSION="release/2.3"
RUN echo "Checkout ${PYTORCH_GIT_VERSION} " && \
git clone --recursive https://github.com/pytorch/pytorch.git -b ${PYTORCH_GIT_VERSION} /pytorch && \
true
# git clone Torchvision you need
### Torchvision Version
ENV TORCH_GIT_VERSION="release/0.18"
RUN echo "Checkout ${TORCH_GIT_VERSION} " && \
git clone https://github.com/pytorch/vision.git -b ${TORCH_GIT_VERSION} /vision && \
true
WORKDIR /pytorch
RUN echo "BULDING PYTORCH $(git describe --tags --exact | sed 's/^v//')" && \
true
RUN python setup.py clean && \
pip install -r requirements.txt && \
true
RUN python3 tools/amd_build/build_amd.py && \
true
RUN echo "** BUILDING PYTORCH *** " && \
export PYTORCH_BUILD_VERSION=$(git describe --tags --exact | sed 's/^v//') && \
export PYTORCH_BUILD_NUMBER=0 && \
python3 setup.py bdist_wheel && \
true
RUN echo "** INSTALL PYTORCH ***" && \
pip install /pytorch/dist/torch*-cp310-cp310-linux_x86_64.whl && \
true
# Build Vision
WORKDIR /vision
RUN export BUILD_VERSION=$(git describe --tags --exact | sed 's/^v//') && \
python3 setup.py bdist_wheel && \
pip install dist/torchvision-*-cp310-cp310-linux_x86_64.whl && \
true
EXPOSE ${PORT}
EXPOSE 22/tcp
#VOLUME [ "/ComfyUI", "/ComfyUI/custom_nodes","/ComfyUI/models","/ComfyUI/output","/ComfyUI/input"]
#ENTRYPOINT python main.py --listen --use-split-cross-attention --port "${PORT}"
CMD ["/bin/bash","-c"]