|
1 | | -FROM pytorch/pytorch:2.4.0-cuda12.1-cudnn9-devel |
| 1 | +FROM ubuntu:22.04 |
2 | 2 |
|
3 | 3 | RUN sed -i "s@http://archive.ubuntu.com@http://mirrors.aliyun.com@g" /etc/apt/sources.list && \ |
4 | 4 | sed -i "s@http://security.ubuntu.com@http://mirrors.aliyun.com@g" /etc/apt/sources.list && \ |
5 | 5 | sed -i "s@http://ports.ubuntu.com@http://mirrors.aliyun.com@g" /etc/apt/sources.list && \ |
6 | 6 | apt-get update && \ |
7 | 7 | apt-get upgrade -y && \ |
8 | | - apt-get install -y git vim watchman wget |
| 8 | + apt-get install -y --no-install-recommends \ |
| 9 | + build-essential ca-certificates \ |
| 10 | + ccache cmake gcc git vim watchman wget curl && \ |
| 11 | + rm -rf /var/lib/apt/lists/* |
9 | 12 |
|
10 | 13 | RUN wget https://tzrec.oss-cn-beijing.aliyuncs.com/third_party/libidn11_1.33-2.2ubuntu2_amd64.deb && \ |
11 | | - apt-get install ./libidn11_1.33-2.2ubuntu2_amd64.deb |
| 14 | + apt-get install ./libidn11_1.33-2.2ubuntu2_amd64.deb && rm libidn11_1.33-2.2ubuntu2_amd64.deb |
12 | 15 |
|
13 | 16 | ADD pip.conf /root/.config/pip/pip.conf |
| 17 | +RUN curl -fsSL -v -o ~/miniconda.sh -O "https://tzrec.oss-cn-beijing.aliyuncs.com/third_party/Miniforge3-Linux-x86_64.sh" && \ |
| 18 | + chmod +x ~/miniconda.sh && \ |
| 19 | + bash ~/miniconda.sh -b -p /opt/conda && \ |
| 20 | + rm ~/miniconda.sh && \ |
| 21 | + /opt/conda/bin/conda update -y -n base -c defaults conda && \ |
| 22 | + /opt/conda/bin/conda install -y python=3.11 && \ |
| 23 | + /opt/conda/bin/conda clean -ya |
| 24 | +ENV PATH /opt/conda/bin:$PATH |
14 | 25 |
|
15 | | -RUN pip install fbgemm-gpu==0.8.0 --index-url https://download.pytorch.org/whl/cu121 && \ |
16 | | - pip install torchmetrics==1.0.3 && \ |
17 | | - pip install torchrec==0.8.0 --index-url https://download.pytorch.org/whl/cu121 && \ |
18 | | - pip install torch_tensorrt==2.4.0 |
| 26 | +ARG DEVICE |
| 27 | +RUN case ${DEVICE} in \ |
| 28 | + "cu121") pip install torch==2.5.0 fbgemm-gpu==1.0.0 --index-url https://download.pytorch.org/whl/cu121 && \ |
| 29 | + pip install torchmetrics==1.0.3 torch_tensorrt==2.5.0 && \ |
| 30 | + pip install torchrec==1.0.0 --index-url https://download.pytorch.org/whl/cu121 ;; \ |
| 31 | + * ) pip install torch==2.5.0 fbgemm-gpu==1.0.0 --index-url https://download.pytorch.org/whl/cpu && \ |
| 32 | + pip install torchmetrics==1.0.3 && \ |
| 33 | + pip install torchrec==1.0.0 --index-url https://download.pytorch.org/whl/cpu ;; \ |
| 34 | + esac && \ |
| 35 | + /opt/conda/bin/conda clean -ya |
| 36 | + |
| 37 | +ENV NVIDIA_VISIBLE_DEVICES all |
| 38 | +ENV NVIDIA_DRIVER_CAPABILITIES compute,utility |
| 39 | +ENV LD_LIBRARY_PATH /usr/local/nvidia/lib:/usr/local/nvidia/lib64 |
| 40 | +ENV PATH /usr/local/nvidia/bin:/usr/local/cuda/bin:$PATH |
19 | 41 |
|
20 | 42 | ADD requirements.txt /root/requirements.txt |
21 | 43 | ADD requirements /root/requirements |
22 | | -RUN cd /root && pip install -r requirements.txt |
| 44 | +RUN cd /root && pip install -r requirements.txt && rm requirements.txt |
0 commit comments