Unverified Commit 3e965912 authored by Xiang Xu's avatar Xiang Xu Committed by GitHub
Browse files

[Enhance]: update dockerfile (#1946)

parent 1beb903f
ARG PYTORCH="1.6.0" ARG PYTORCH="1.9.0"
ARG CUDA="10.1" ARG CUDA="11.1"
ARG CUDNN="7" ARG CUDNN="8"
ARG MMCV="1.5.0"
ARG MMDET="2.19.0"
ARG MMSEG="0.20.0"
FROM pytorch/pytorch:${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel FROM pytorch/pytorch:${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel
ENV TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0+PTX" ENV TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0 7.5 8.0 8.6+PTX" \
ENV TORCH_NVCC_FLAGS="-Xfatbin -compress-all" TORCH_NVCC_FLAGS="-Xfatbin -compress-all" \
ENV CMAKE_PREFIX_PATH="$(dirname $(which conda))/../" CMAKE_PREFIX_PATH="$(dirname $(which conda))/../" \
FORCE_CUDA="1"
# Avoid Public GPG key error
# https://github.com/NVIDIA/nvidia-docker/issues/1631
RUN rm /etc/apt/sources.list.d/cuda.list \
&& rm /etc/apt/sources.list.d/nvidia-ml.list \
&& apt-key del 7fa2af80 \
&& apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub \
&& apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
# To fix GPG key error when running apt-get update # (Optional, use Mirror to speed up downloads)
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub # RUN sed -i 's/http:\/\/archive.ubuntu.com\/ubuntu\//http:\/\/mirrors.aliyun.com\/ubuntu\//g' /etc/apt/sources.list && \
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub # pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
RUN apt-get update && apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 \ # Install the required packages
RUN apt-get update \
&& apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 \
&& apt-get clean \ && apt-get clean \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Install MMCV, MMDetection and MMSegmentation # Install MMEngine, MMCV and MMDetection
ARG PYTORCH RUN pip install openmim && \
ARG CUDA mim install "mmengine" "mmcv>=2.0.0rc1" "mmdet>=3.0.0rc0"
ARG MMCV
ARG MMDET
ARG MMSEG
RUN ["/bin/bash", "-c", "pip install --no-cache-dir mmcv-full==${MMCV} -f https://download.openmmlab.com/mmcv/dist/cu${CUDA//./}/torch${PYTORCH}/index.html"]
RUN pip install --no-cache-dir mmdet==${MMDET} mmsegmentation==${MMSEG}
# Install MMDetection3D # Install MMDetection3D
RUN conda clean --all RUN conda clean --all \
COPY . /mmdetection3d && git clone https://github.com/open-mmlab/mmdetection3d.git -b dev-1.x /mmdetection3d \
&& cd /mmdetection \
&& pip install --no-cache-dir -e .
WORKDIR /mmdetection3d WORKDIR /mmdetection3d
ENV FORCE_CUDA="1"
RUN pip install -r requirements/build.txt
RUN pip install --no-cache-dir -e .
ARG PYTORCH="1.6.0" ARG PYTORCH="1.9.0"
ARG CUDA="10.1" ARG CUDA="11.1"
ARG CUDNN="7" ARG CUDNN="8"
FROM pytorch/pytorch:${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel FROM pytorch/pytorch:${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel
ARG MMCV="1.3.8" ARG MMCV="2.0.0rc4"
ARG MMSEGMENTATION="0.14.1" ARG MMDET="3.0.0rc5"
ARG MMDET="2.14.0" ARG MMDET3D="1.1.0rc3"
ARG MMDET3D="0.17.1"
ENV PYTHONUNBUFFERED TRUE ENV PYTHONUNBUFFERED TRUE
# Avoid Public GPG key error
# https://github.com/NVIDIA/nvidia-docker/issues/1631
RUN rm /etc/apt/sources.list.d/cuda.list \
&& rm /etc/apt/sources.list.d/nvidia-ml.list \
&& apt-key del 7fa2af80 \
&& apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub \
&& apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
# (Optional, use Mirror to speed up downloads)
# RUN sed -i 's/http:\/\/archive.ubuntu.com\/ubuntu\//http:\/\/mirrors.aliyun.com\/ubuntu\//g' /etc/apt/sources.list
# Install the required packages
RUN apt-get update && \ RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
ca-certificates \ ca-certificates \
...@@ -19,8 +30,8 @@ RUN apt-get update && \ ...@@ -19,8 +30,8 @@ RUN apt-get update && \
ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 \ ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
ENV PATH="/opt/conda/bin:$PATH" ENV PATH="/opt/conda/bin:$PATH" \
RUN export FORCE_CUDA=1 FORCE_CUDA="1"
# TORCHSEVER # TORCHSEVER
RUN pip install torchserve torch-model-archiver RUN pip install torchserve torch-model-archiver
...@@ -28,11 +39,11 @@ RUN pip install torchserve torch-model-archiver ...@@ -28,11 +39,11 @@ RUN pip install torchserve torch-model-archiver
# MMLAB # MMLAB
ARG PYTORCH ARG PYTORCH
ARG CUDA ARG CUDA
RUN ["/bin/bash", "-c", "pip install mmcv-full==${MMCV} -f https://download.openmmlab.com/mmcv/dist/cu${CUDA//./}/torch${PYTORCH}/index.html"] RUN pip install openmim
RUN pip install mmdet==${MMDET} RUN mim install mmengine
RUN pip install mmsegmentation==${MMSEGMENTATION} RUN mim install mmcv==${MMCV}
RUN pip install mmdet3d==${MMDET3D} RUN mim install mmdet==${MMDET}
RUN mim install mmdet3d==${MMDET3D}
RUN useradd -m model-server \ RUN useradd -m model-server \
&& mkdir -p /home/model-server/tmp && mkdir -p /home/model-server/tmp
......
...@@ -253,7 +253,7 @@ Within Jupyter, the exclamation mark `!` is used to call external executables an ...@@ -253,7 +253,7 @@ Within Jupyter, the exclamation mark `!` is used to call external executables an
We provide a [Dockerfile](https://github.com/open-mmlab/mmdetection3d/blob/dev-1.x/docker/Dockerfile) to build an image. Ensure that your [docker version](https://docs.docker.com/engine/install/) >= 19.03. We provide a [Dockerfile](https://github.com/open-mmlab/mmdetection3d/blob/dev-1.x/docker/Dockerfile) to build an image. Ensure that your [docker version](https://docs.docker.com/engine/install/) >= 19.03.
```shell ```shell
# build an image with PyTorch 1.6, CUDA 10.1 # build an image with PyTorch 1.9, CUDA 11.1
# If you prefer other versions, just modified the Dockerfile # If you prefer other versions, just modified the Dockerfile
docker build -t mmdetection3d docker/ docker build -t mmdetection3d docker/
``` ```
......
...@@ -250,7 +250,7 @@ print(mmdet3d.__version__) ...@@ -250,7 +250,7 @@ print(mmdet3d.__version__)
我们提供了 [Dockerfile](https://github.com/open-mmlab/mmdetection3d/blob/dev-1.x/docker/Dockerfile) 来构建一个镜像。请确保您的 [docker 版本](https://docs.docker.com/engine/install/) >= 19.03。 我们提供了 [Dockerfile](https://github.com/open-mmlab/mmdetection3d/blob/dev-1.x/docker/Dockerfile) 来构建一个镜像。请确保您的 [docker 版本](https://docs.docker.com/engine/install/) >= 19.03。
```shell ```shell
# 基于 PyTorch 1.6,CUDA 10.1 构建镜像 # 基于 PyTorch 1.9,CUDA 11.1 构建镜像
# 如果您想要其他版本,只需要修改 Dockerfile # 如果您想要其他版本,只需要修改 Dockerfile
docker build -t mmdetection3d docker/ docker build -t mmdetection3d docker/
``` ```
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment