Spaces:
Running
on
T4
Running
on
T4
FROM nvcr.io/nvidia/pytorch:22.04-py3 | |
WORKDIR /openmmlab | |
ARG ONNXRUNTIME_VERSION=1.8.1 | |
ENV DEBIAN_FRONTEND=noninteractive \ | |
APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn \ | |
FORCE_CUDA="1" | |
# Install ZSH | |
RUN apt-get update \ | |
&& apt-get install -y zsh \ | |
&& wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh || true | |
# Install Prerequisites | |
RUN apt-get update \ | |
&& apt-get install -y git vim wget | |
RUN pip install -U ipdb pip | |
# Install ONNXRUNTIME | |
RUN wget -q https://github.com/microsoft/onnxruntime/releases/download/v${ONNXRUNTIME_VERSION}/onnxruntime-linux-x64-${ONNXRUNTIME_VERSION}.tgz \ | |
&& tar -zxvf onnxruntime-linux-x64-${ONNXRUNTIME_VERSION}.tgz \ | |
&& pip install --no-cache-dir onnxruntime-gpu==${ONNXRUNTIME_VERSION} \ | |
&& pip install pycuda | |
# Install OpenMMLab | |
RUN pip install --no-cache-dir openmim \ | |
&& mim install --no-cache-dir "mmengine>=0.6.0" "mmdet>=3.0.0,<4.0.0" \ | |
&& mim install --no-cache-dir opencv-python==4.5.5.64 opencv-python-headless==4.5.5.64 | |
# Install MMCV | |
RUN git clone https://github.com/open-mmlab/mmcv.git -b 2.x mmcv \ | |
&& cd mmcv \ | |
&& mim install --no-cache-dir -r requirements/optional.txt \ | |
&& MMCV_WITH_OPS=1 mim install --no-cache-dir -e . -v \ | |
&& cd .. | |
# Install MMYOLO | |
RUN git clone https://github.com/open-mmlab/mmyolo.git -b dev mmyolo \ | |
&& cd mmyolo \ | |
&& mim install --no-cache-dir -e . \ | |
&& cd .. | |
# Install MMDEPLOY | |
ENV ONNXRUNTIME_DIR=/openmmlab/onnxruntime-linux-x64-${ONNXRUNTIME_VERSION} \ | |
TENSORRT_DIR=/usr/lib/x86_64-linux-gnu \ | |
CUDNN_DIR=/usr/lib/x86_64-linux-gnu | |
RUN git clone https://github.com/open-mmlab/mmdeploy -b dev-1.x mmdeploy \ | |
&& cd mmdeploy \ | |
&& git submodule update --init --recursive \ | |
&& mkdir -p build \ | |
&& cd build \ | |
&& cmake -DMMDEPLOY_TARGET_BACKENDS="ort;trt" -DONNXRUNTIME_DIR=${ONNXRUNTIME_DIR} -DTENSORRT_DIR=${TENSORRT_DIR} -DCUDNN_DIR=${CUDNN_DIR} .. \ | |
&& make -j$(nproc) \ | |
&& make install \ | |
&& cd .. \ | |
&& mim install --no-cache-dir -e . | |
# RUN apt-get install libopencv-dev -y | |
# Fix undefined symbol bug | |
RUN echo -e "\nexport LD_LIBRARY_PATH=${ONNXRUNTIME_DIR}/lib:${TENSORRT_DIR}/lib:${CUDNN_DIR}/lib64:${LD_LIBRARY_PATH}\nldconfig" >> /root/.bashrc | |
# RUN apt-get update -y \ | |
# && apt-get install -y iputils-ping |