Skip to content

Commit 7e8d914

Browse files
committed
Add conda support
1 parent 6272f19 commit 7e8d914

4 files changed

Lines changed: 47 additions & 7 deletions

File tree

dockerfiles/conda/Dockerfile

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,43 @@ RUN conda init && \
1515
conda install python=$PY_VERSION -y && \
1616
conda install -c "nvidia/label/cuda-$DOCKER_CUDA_VERSION" cuda -y
1717

18-
# RUN conda init && \
19-
# pip install torch==$TORCH_VERSION torchvision==$TORCH_VISION_VERSION torchaudio==$TORCH_VERSION --index-url https://download.pytorch.org/whl/cu$(cat /CUDA_VERSION | awk -F. '{print $1$2}')
18+
# torch installer
19+
COPY <<EOF /usr/local/bin/install_torch_env
20+
#!/bin/bash
21+
set -e
22+
TORCH_VER=\$1
23+
VISION_VER=\$2
24+
CUDA_VER=\$3
25+
FLASH_ATTN_LINK=\$4
26+
27+
conda create -n torch\${TORCH_VER}
28+
29+
export PATH_BCK=\$PATH
30+
export PATH=/root/anaconda/envs/torch\${TORCH_VER}:\$PATH
31+
32+
pip install --no-cache-dir torch=="\${TORCH_VER}" torchvision=="\${VISION_VER}" torchaudio=="\${TORCH_VER}" --index-url "https://download.pytorch.org/whl/\${CUDA_VER}"
33+
pip install --no-cache-dir \$FLASH_ATTN_LINK
34+
35+
"""conda activate torch\${TORCH_VER} && echo "export PATH=/root/anaconda/envs/torch\${TORCH_VER}:\\\$PATH && source activate torch\${TORCH_VER}" &>> ~/.bashrc""" > /usr/local/bin/init_torch\${TORCH_VER}
36+
chmod +x /usr/local/bin/init_torch\${TORCH_VER}
37+
38+
export PATH=\$PATH_BCK
39+
40+
EOF
41+
42+
RUN chmod +x /usr/local/bin/install_torch_env
43+
44+
# pytorch 2.4.1 (251209 Update)
45+
RUN install_torch_env 2.4.1 0.19.1 cu124 https://github.com/mjun0812/flash-attention-prebuild-wheels/releases/download/v0.3.12/flash_attn-2.8.0+cu124torch2.4-cp310-cp310-linux_x86_64.whl
46+
47+
# pytorch 2.5.1 (251209 Update)
48+
RUN install_torch_env 2.5.1 0.20.1 cu124 https://github.com/mjun0812/flash-attention-prebuild-wheels/releases/download/v0.4.11/flash_attn-2.8.3+cu124torch2.5-cp310-cp310-linux_x86_64.whl
49+
50+
# pytorch 2.6.0 (251209 Update)
51+
RUN install_torch_env 2.6.0 0.21.0 cu124 https://github.com/mjun0812/flash-attention-prebuild-wheels/releases/download/v0.4.11/flash_attn-2.8.3+cu124torch2.6-cp310-cp310-linux_x86_64.whl
52+
53+
# pytorch 2.7.1 (251209 Update)
54+
RUN install_torch_env 2.7.1 0.22.1 cu126 https://github.com/mjun0812/flash-attention-prebuild-wheels/releases/download/v0.4.11/flash_attn-2.8.3+cu126torch2.7-cp310-cp310-linux_x86_64.whl
55+
56+
# pytorch 2.9.0 (251209 Update)
57+
RUN install_torch_env 2.9.0 0.24.0 cu126 https://github.com/mjun0812/flash-attention-prebuild-wheels/releases/download/v0.4.17/flash_attn-2.6.3+cu126torch2.9-cp310-cp310-linux_x86_64.whl

dockerfiles/conda/build_conda.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@ PY_VERSION=$1
22
DATE=251214 # $(date +"%y%m%d")
33
TAG=junwha/ddiff-base:cu12.4.1-py${PY_VERSION}-conda-$DATE
44

5-
docker build -t $TAG --build-arg PY_VERSION=${PY_VERSION} ./ && \
6-
./test.sh $TAG && docker push $TAG
5+
docker build -t $TAG --build-arg PY_VERSION=${PY_VERSION} ./
6+
7+
# && \
8+
# ./test.sh $TAG && docker push $TAG

dockerfiles/conda/deprecated/Dockerfile.torch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ FROM junwha/dslice-base-py:${BASE_TAG}
99
ARG TORCH_VERSION
1010
ARG TORCH_VISION_VERSION
1111

12-
# RUN conda init && \
13-
# pip install torch==$TORCH_VERSION torchvision==$TORCH_VISION_VERSION torchaudio==$TORCH_VERSION --index-url https://download.pytorch.org/whl/cu$(cat /CUDA_VERSION | awk -F. '{print $1$2}')
12+
RUN conda init && \
13+
pip install torch==$TORCH_VERSION torchvision==$TORCH_VISION_VERSION torchaudio==$TORCH_VERSION --index-url https://download.pytorch.org/whl/cu$(cat /CUDA_VERSION | awk -F. '{print $1$2}')

dockerfiles/uv/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ uv venv --python "\${PY_VERSION}" --system-site-packages --seed
2626
uv pip install --no-cache torch=="\${TORCH_VER}" torchvision=="\${VISION_VER}" torchaudio=="\${TORCH_VER}" --index-url "https://download.pytorch.org/whl/\${CUDA_VER}"
2727
uv pip install --no-cache \$FLASH_ATTN_LINK
2828
echo "ln -sfn \${BASE_DIR}/.venv ./.venv && [ -f pyproject.toml ] && uv add torch==\${TORCH_VER} torchvision==\${VISION_VER} torchaudio==\${TORCH_VER}; echo Created uv virtual environment with torch==\${TORCH_VER}" > /usr/local/bin/uv_init_torch\${TORCH_VER}
29-
chmod +x /usr/local/bin/uv_init_torch\${TORCH_VER}
29+
chmod +x /usr/local/bin/init_torch\${TORCH_VER}
3030
EOF
3131
RUN chmod +x /usr/local/bin/install_torch_env
3232

0 commit comments

Comments
 (0)