-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathconda_forward_script
75 lines (67 loc) · 3.47 KB
/
conda_forward_script
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
FROM ubuntu:20.04
LABEL maintainer="[email protected]"
#conda
ARG PYTHON_VERSION="3.8"
RUN curl -o /.gemfield_install/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
chmod +x /.gemfield_install/miniconda.sh && \
/.gemfield_install/miniconda.sh -b -p /opt/conda && \
rm /.gemfield_install/miniconda.sh && \
/opt/conda/bin/conda install -y python=${PYTHON_VERSION} conda-build anaconda-client astunparse numpy pyyaml scipy ipython mkl mkl-include \
cffi ninja setuptools typing_extensions future six requests dataclasses cython typing && \
/opt/conda/bin/conda clean -ya && \
/opt/conda/bin/conda clean -y --force-pkgs-dirs
ENV PATH /opt/conda/bin:$PATH
RUN conda config --add channels pytorch && \
conda config --add channels nvidia && \
ln -sf /opt/conda/bin/python3 /opt/conda/bin/python
# RUN conda uninstall -y magma-cuda111 cudatoolkit && \
# conda install -y magma-cuda112 && \
# conda clean -ya && \
# conda clean -y --force-pkgs-dirs
#basic python package
RUN /opt/conda/bin/pip3 install --no-cache-dir Pillow opencv-python easydict sklearn matplotlib tensorboard fonttools \
onnx==1.8.1 onnxruntime onnx-coreml coremltools onnx-simplifier pycocotools requests protobuf && \
conda clean -ya && \
conda clean -y --force-pkgs-dirs
#pytorch
#note: torchpod pro version will install pytorch from gemfield channel
ARG MAGMA_CUDA_VER=111
ARG CUDA_VERSION=11.1
RUN conda install -y magma-cuda${MAGMA_CUDA_VER} pytorch torchvision torchaudio torchtext cudatoolkit=${CUDA_VERSION} -c pytorch -c nvidia && \
conda clean -ya && \
conda clean -y --force-pkgs-dirs
#nvidia label
LABEL com.nvidia.volumes.needed="nvidia_driver"
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
#forward framework
WORKDIR /.gemfield_install
ARG TNN_VER="0.3.0"
ARG MNN_VER="1.2.0"
ARG NCNN_VER="20210525"
ARG PYTHON_SO_VER="38"
#tnn
RUN git clone https://github.com/Tencent/TNN.git && cd TNN && \
git checkout --recurse-submodules tags/v${TNN_VER} -b v${TNN_VER}-branch && \
mkdir build && cd build && \
cmake -DCMAKE_BUILD_TYPE=RELEASE -DTNN_CONVERTER_ENABLE=ON -DTNN_ONNX2TNN_ENABLE=ON .. && make VERBOSE=1 && \
cp /.gemfield_install/TNN/build/tools/onnx2tnn/onnx-converter/onnx2tnn.cpython-${PYTHON_SO_VER}-x86_64-linux-gnu.so /opt/conda/lib/python${PYTHON_VERSION}/site-packages/ && \
cp /.gemfield_install/TNN/build/libTNN.so /lib/ && ln -s /lib/libTNN.so /lib/libTNN.so.0 && \
cd ../.. && rm -rf TNN
#ncnn
RUN git clone https://github.com/Tencent/ncnn.git && cd ncnn && \
git checkout --recurse-submodules tags/${NCNN_VER} -b v${NCNN_VER}-branch && \
mkdir build && cd build && \
cmake -DCMAKE_BUILD_TYPE=RELEASE -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_BUILD_TOOLS=ON .. && make VERBOSE=1 && \
cp /.gemfield_install/ncnn/build/tools/onnx/onnx2ncnn /bin/ && \
cd ../.. && rm -rf ncnn
#mnn
RUN git clone https://github.com/alibaba/MNN.git && cd MNN && \
git checkout --recurse-submodules tags/${MNN_VER} -b v${MNN_VER}-branch && \
mkdir build && cd build && \
cmake -DCMAKE_BUILD_TYPE=RELEASE -DMNN_BUILD_CONVERTER=ON .. && make VERBOSE=1 && \
cp /.gemfield_install/MNN/build/MNNConvert /bin/ && \
cp /.gemfield_install/MNN/build/libMNN.so /lib/ && \
cp /.gemfield_install/MNN/build/tools/converter/libMNNConvertDeps.so /lib/ && \
cp /.gemfield_install/MNN/build/express/libMNN_Express.so /lib/ && \
cd ../.. && rm -rf MNN