From be3e913cd78aa31f2baefdca371ef583f93e914c Mon Sep 17 00:00:00 2001 From: FrAnCOisCokELaER Date: Fri, 24 Jul 2020 16:30:10 +0200 Subject: [PATCH 1/5] Docker for users #1214 - prebuilt docker image handling Ignite examples configuration --- docker/Dockerfile_examples | 17 +++++++++++++++++ docker/README.md | 21 +++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 docker/Dockerfile_examples create mode 100644 docker/README.md diff --git a/docker/Dockerfile_examples b/docker/Dockerfile_examples new file mode 100644 index 000000000000..7d1efc15c690 --- /dev/null +++ b/docker/Dockerfile_examples @@ -0,0 +1,17 @@ +FROM pytorch/pytorch:latest + +RUN apt-get update && apt-get install -y --no-install-recommends \ + git && \ + rm -rf /var/lib/apt/lists/* + +# install Ignite and "examples" requirements +RUN conda install ignite -c pytorch && \ + conda install -y pillow tensorboard tqdm && \ + conda install -y -c conda-forge opencv albumentations && \ + conda install -y -c vfdev-5 image_dataset_viz && \ + conda clean -ya + +# install py-config-runner from pip +RUN pip --no-cache-dir install py-config-runner + +ENTRYPOINT ["/bin/sh"] \ No newline at end of file diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 000000000000..5bc4546ce44e --- /dev/null +++ b/docker/README.md @@ -0,0 +1,21 @@ +# Docker for Ignite examples + +Usage: + +Pulling ignite-examples image: +``` +docker pull pytorchignite/ignite-examples:latest +``` +Running "/bin/sh" in the container with a mount point on "examples" from Ignite root folder: +``` +docker run -v ${PWD}/examples:/workspace/examples -it pytorchignite/ignite-examples:latest +``` +In the container, launching MNIST example: +``` +cd examples/mnist +python mnist_with_tensorboard.py --log_dir=/tmp/tensorboard_logs +``` +With GPU support: +``` +docker run --gpus 1 -v ${PWD}/examples:/workspace/examples -it pytorchignite/ignite-examples:latest +``` From 07416a80d46e4ca6d9941abff458777adf362e27 Mon Sep 17 00:00:00 2001 From: FrAnCOisCokELaER Date: Mon, 27 Jul 2020 19:25:34 +0200 Subject: [PATCH 2/5] Docker for users #1214 - more complete basic image based on pytorch 1.5.1-cuda10.1-cudnn7-devel - with apex, opencv setups and pascal_voc2012 requirements _ container running with non-privileged user --- docker/Dockerfile_examples | 17 ---------- docker/README.md | 24 +++----------- docker/basic/Dockerfile | 64 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 36 deletions(-) delete mode 100644 docker/Dockerfile_examples create mode 100644 docker/basic/Dockerfile diff --git a/docker/Dockerfile_examples b/docker/Dockerfile_examples deleted file mode 100644 index 7d1efc15c690..000000000000 --- a/docker/Dockerfile_examples +++ /dev/null @@ -1,17 +0,0 @@ -FROM pytorch/pytorch:latest - -RUN apt-get update && apt-get install -y --no-install-recommends \ - git && \ - rm -rf /var/lib/apt/lists/* - -# install Ignite and "examples" requirements -RUN conda install ignite -c pytorch && \ - conda install -y pillow tensorboard tqdm && \ - conda install -y -c conda-forge opencv albumentations && \ - conda install -y -c vfdev-5 image_dataset_viz && \ - conda clean -ya - -# install py-config-runner from pip -RUN pip --no-cache-dir install py-config-runner - -ENTRYPOINT ["/bin/sh"] \ No newline at end of file diff --git a/docker/README.md b/docker/README.md index 5bc4546ce44e..c3645f295416 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,21 +1,7 @@ -# Docker for Ignite examples +# Convenient docker images -Usage: +In this folder we provide Dockerfiles to build docker images with PyTorch, Ignite and other convenient libraries: -Pulling ignite-examples image: -``` -docker pull pytorchignite/ignite-examples:latest -``` -Running "/bin/sh" in the container with a mount point on "examples" from Ignite root folder: -``` -docker run -v ${PWD}/examples:/workspace/examples -it pytorchignite/ignite-examples:latest -``` -In the container, launching MNIST example: -``` -cd examples/mnist -python mnist_with_tensorboard.py --log_dir=/tmp/tensorboard_logs -``` -With GPU support: -``` -docker run --gpus 1 -v ${PWD}/examples:/workspace/examples -it pytorchignite/ignite-examples:latest -``` +- [basic](basic/Dockerfile): latest stable PyTorch, latest stable Ignite, OpenCV, Albumentations, Nvidia/Apex, etc + +- [ignite-hvd](ignite-hvd/Dockerfile) : latest stable PyTorch, latest stable Ignite, Horovod diff --git a/docker/basic/Dockerfile b/docker/basic/Dockerfile new file mode 100644 index 000000000000..ce2e76228b2d --- /dev/null +++ b/docker/basic/Dockerfile @@ -0,0 +1,64 @@ +FROM pytorch/pytorch:1.5.1-cuda10.1-cudnn7-devel + +#install git +RUN apt-get update && apt-get install -y --no-install-recommends \ + git && \ + rm -rf /var/lib/apt/lists/* + +#setup opencv +RUN echo '#!/bin/bash\n\ +python -c "import cv2"\n\ +res=$?\n\ +if [ "$res" -eq "1" ]; then\n\ + echo "Install libglib2.0 libsm6 libxext6 libxrender-dev for opencv"\n\ + apt-get update\n\ + ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime\n\ + apt-get install -y tzdata\n\ + dpkg-reconfigure --frontend noninteractive tzdata\n\ + apt-get -y install --no-install-recommends libglib2.0 libsm6 libxext6 libxrender-dev\n\ +fi\n'\ +>> setup_opencv.sh + +RUN sh setup_opencv.sh + +#setup apex +RUN echo '#!/bin/bash\n\ +tmp_apex_path="/tmp/apex"\n\ +python -c "import apex"\n\ +res=$?\n\ +if [ "$res" -eq "1" ]; then\n\ + echo "Setup NVIDIA Apex"\n\ + rm -rf $tmp_apex_path\n\ + git clone https://github.com/NVIDIA/apex $tmp_apex_path\n\ + cd $tmp_apex_path\n\ + export TORCH_CUDA_ARCH_LIST="6.0;6.1;6.2;7.0;7.5"\n\ + pip install --upgrade --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" .\n\ +fi\n'\ +>> setup_apex.sh + +RUN sh setup_apex.sh + +RUN echo 'albumentations\n\ + image-dataset-viz\n\ + numpy\n\ + opencv-python\n\ + py_config_runner\n\ + pytorch-ignite\n\ + pillow\n\ + tensorboard\n\ + tqdm\n\ + trains>=0.15.0\n'\ +>> requirements.txt + +RUN pip install --upgrade --no-cache-dir -r requirements.txt + +#create a non-privileged docker user (for debian) +RUN groupadd -g 61000 ignite \ + && useradd -g 61000 -l -M \ + -s /sbin/nologin -u 61000 ignite + +RUN chown -R ignite:ignite /workspace + +USER ignite + +ENTRYPOINT ["/bin/sh"] \ No newline at end of file From 463e6ec981093d4b15667ee537bc0dca0fb16c14 Mon Sep 17 00:00:00 2001 From: FrAnCOisCokELaER Date: Fri, 7 Aug 2020 09:10:21 +0200 Subject: [PATCH 3/5] Docker for users #1214 - improve Dockerfiles for vision and apex-vision (TORCH_CUDA_ARCH_LIST as argument) - propose apex-vision with multi-stage build --- docker/README.md | 5 +-- docker/apex-vision/Dockerfile.apex | 61 ++++++++++++++++++++++++++++ docker/basic/Dockerfile | 64 ------------------------------ docker/vision/Dockerfile | 36 +++++++++++++++++ 4 files changed, 99 insertions(+), 67 deletions(-) create mode 100644 docker/apex-vision/Dockerfile.apex delete mode 100644 docker/basic/Dockerfile create mode 100644 docker/vision/Dockerfile diff --git a/docker/README.md b/docker/README.md index c3645f295416..a57b93888b4d 100644 --- a/docker/README.md +++ b/docker/README.md @@ -2,6 +2,5 @@ In this folder we provide Dockerfiles to build docker images with PyTorch, Ignite and other convenient libraries: -- [basic](basic/Dockerfile): latest stable PyTorch, latest stable Ignite, OpenCV, Albumentations, Nvidia/Apex, etc - -- [ignite-hvd](ignite-hvd/Dockerfile) : latest stable PyTorch, latest stable Ignite, Horovod +- [vision](vision/Dockerfile): latest stable PyTorch, latest stable Ignite, OpenCV, Albumentations, etc +- [apex-vision](apex-vision/Dockerfile.apex): vision with NVIDIA/Apex diff --git a/docker/apex-vision/Dockerfile.apex b/docker/apex-vision/Dockerfile.apex new file mode 100644 index 000000000000..5946c2a46f4c --- /dev/null +++ b/docker/apex-vision/Dockerfile.apex @@ -0,0 +1,61 @@ +#multi-stage build +#1/ building apex with pytorch:1.6.0-cuda10.1-cudnn7-devel +FROM pytorch/pytorch:1.6.0-cuda10.1-cudnn7-devel AS apex-builder + +ARG ARG_TORCH_CUDA_ARCH_LIST="6.0;6.1;6.2;7.0;7.5" +ENV TORCH_CUDA_ARCH_LIST=$ARG_TORCH_CUDA_ARCH_LIST + +#install git +RUN apt-get update && apt-get install -y --no-install-recommends \ + git && \ + rm -rf /var/lib/apt/lists/* + +#building apex +RUN echo "Setup NVIDIA Apex" && \ + tmp_apex_path="/tmp/apex" && \ + rm -rf $tmp_apex_path && \ + git clone https://github.com/NVIDIA/apex $tmp_apex_path && \ + cd $tmp_apex_path && \ + pip wheel --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" . + +#2/ build the runtime image +FROM pytorch/pytorch:latest + +COPY --from=apex-builder /tmp/apex/apex-0.1-cp37-cp37m-linux_x86_64.whl apex-0.1-cp37-cp37m-linux_x86_64.whl +RUN pip install --no-cache-dir apex-0.1-cp37-cp37m-linux_x86_64.whl && \ + rm apex-0.1-cp37-cp37m-linux_x86_64.whl + +#install tzdata / opencv dependencies / git +RUN apt-get update && \ + ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime && \ + apt-get install -y tzdata && \ + dpkg-reconfigure --frontend noninteractive tzdata && \ + apt-get -y install --no-install-recommends libglib2.0 \ + libsm6 \ + libxext6 \ + libxrender-dev \ + git && \ + rm -rf /var/lib/apt/lists/* + +#install ignite vison dependencies +RUN pip install --upgrade --no-cache-dir albumentations \ + image-dataset-viz \ + numpy \ + opencv-python \ + py_config_runner \ + pytorch-ignite \ + pillow \ + tensorboard \ + tqdm \ + "trains>=0.15.0" + +#create a non-privileged docker user (for debian) +RUN groupadd -g 61000 ignite \ + && useradd -g 61000 -l -M \ + -s /sbin/nologin -u 61000 ignite + +RUN chown -R ignite:ignite /workspace + +USER ignite + +ENTRYPOINT ["/bin/bash"] \ No newline at end of file diff --git a/docker/basic/Dockerfile b/docker/basic/Dockerfile deleted file mode 100644 index ce2e76228b2d..000000000000 --- a/docker/basic/Dockerfile +++ /dev/null @@ -1,64 +0,0 @@ -FROM pytorch/pytorch:1.5.1-cuda10.1-cudnn7-devel - -#install git -RUN apt-get update && apt-get install -y --no-install-recommends \ - git && \ - rm -rf /var/lib/apt/lists/* - -#setup opencv -RUN echo '#!/bin/bash\n\ -python -c "import cv2"\n\ -res=$?\n\ -if [ "$res" -eq "1" ]; then\n\ - echo "Install libglib2.0 libsm6 libxext6 libxrender-dev for opencv"\n\ - apt-get update\n\ - ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime\n\ - apt-get install -y tzdata\n\ - dpkg-reconfigure --frontend noninteractive tzdata\n\ - apt-get -y install --no-install-recommends libglib2.0 libsm6 libxext6 libxrender-dev\n\ -fi\n'\ ->> setup_opencv.sh - -RUN sh setup_opencv.sh - -#setup apex -RUN echo '#!/bin/bash\n\ -tmp_apex_path="/tmp/apex"\n\ -python -c "import apex"\n\ -res=$?\n\ -if [ "$res" -eq "1" ]; then\n\ - echo "Setup NVIDIA Apex"\n\ - rm -rf $tmp_apex_path\n\ - git clone https://github.com/NVIDIA/apex $tmp_apex_path\n\ - cd $tmp_apex_path\n\ - export TORCH_CUDA_ARCH_LIST="6.0;6.1;6.2;7.0;7.5"\n\ - pip install --upgrade --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" .\n\ -fi\n'\ ->> setup_apex.sh - -RUN sh setup_apex.sh - -RUN echo 'albumentations\n\ - image-dataset-viz\n\ - numpy\n\ - opencv-python\n\ - py_config_runner\n\ - pytorch-ignite\n\ - pillow\n\ - tensorboard\n\ - tqdm\n\ - trains>=0.15.0\n'\ ->> requirements.txt - -RUN pip install --upgrade --no-cache-dir -r requirements.txt - -#create a non-privileged docker user (for debian) -RUN groupadd -g 61000 ignite \ - && useradd -g 61000 -l -M \ - -s /sbin/nologin -u 61000 ignite - -RUN chown -R ignite:ignite /workspace - -USER ignite - -ENTRYPOINT ["/bin/sh"] \ No newline at end of file diff --git a/docker/vision/Dockerfile b/docker/vision/Dockerfile new file mode 100644 index 000000000000..189e5096883c --- /dev/null +++ b/docker/vision/Dockerfile @@ -0,0 +1,36 @@ +FROM pytorch/pytorch:latest + +#install tzdata / opencv dependencies / git +RUN apt-get update && \ + ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime && \ + apt-get install -y tzdata && \ + dpkg-reconfigure --frontend noninteractive tzdata && \ + apt-get -y install --no-install-recommends libglib2.0 \ + libsm6 \ + libxext6 \ + libxrender-dev \ + git && \ + rm -rf /var/lib/apt/lists/* + +#ignite vision dependencies +RUN pip install --upgrade --no-cache-dir albumentations \ + image-dataset-viz \ + numpy \ + opencv-python \ + py_config_runner \ + pytorch-ignite \ + pillow \ + tensorboard \ + tqdm \ + "trains>=0.15.0" + +#create a non-privileged docker user (for debian) +RUN groupadd -g 61000 ignite \ + && useradd -g 61000 -l -M \ + -s /sbin/nologin -u 61000 ignite + +RUN chown -R ignite:ignite /workspace + +USER ignite + +ENTRYPOINT ["/bin/bash"] \ No newline at end of file From 5ffce76a202be5450ef7fc9caf5e7a5be47c03fa Mon Sep 17 00:00:00 2001 From: FrAnCOisCokELaER Date: Tue, 18 Aug 2020 22:11:49 +0200 Subject: [PATCH 4/5] Docker for users #1214 - Dockerfiles for nlp and vision tasks with their apex version - user as root, Ignite examples added --- docker/README.md | 23 ++++++++--- docker/apex-vision/Dockerfile.apex | 61 ------------------------------ docker/main/Dockerfile.apex | 49 ++++++++++++++++++++++++ docker/main/Dockerfile.apex-nlp | 10 +++++ docker/main/Dockerfile.apex-vision | 21 ++++++++++ docker/main/Dockerfile.base | 25 ++++++++++++ docker/main/Dockerfile.nlp | 10 +++++ docker/main/Dockerfile.vision | 21 ++++++++++ docker/vision/Dockerfile | 36 ------------------ 9 files changed, 153 insertions(+), 103 deletions(-) delete mode 100644 docker/apex-vision/Dockerfile.apex create mode 100644 docker/main/Dockerfile.apex create mode 100644 docker/main/Dockerfile.apex-nlp create mode 100644 docker/main/Dockerfile.apex-vision create mode 100644 docker/main/Dockerfile.base create mode 100644 docker/main/Dockerfile.nlp create mode 100644 docker/main/Dockerfile.vision delete mode 100644 docker/vision/Dockerfile diff --git a/docker/README.md b/docker/README.md index a57b93888b4d..d16b8a7e1f5f 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,6 +1,17 @@ -# Convenient docker images - -In this folder we provide Dockerfiles to build docker images with PyTorch, Ignite and other convenient libraries: - -- [vision](vision/Dockerfile): latest stable PyTorch, latest stable Ignite, OpenCV, Albumentations, etc -- [apex-vision](apex-vision/Dockerfile.apex): vision with NVIDIA/Apex +# Docker for users +We provide Dockerfiles in order to build containerized execution environment that ease the use of Ignite for computer vision and NLP tasks. +## Installation +- [main/Dockerfile.base](main/Dockerfile.base): latest stable PyTorch, Ignite with minimal dependencies + * `docker pull pytorchignite/base:latest` +- [main/Dockerfile.vision](main/Dockerfile.vision): base image with useful computer vision libraries + * `docker pull pytorchignite/vision:latest` +- [main/Dockerfile.nlp](main/Dockerfile.nlp): base image with useful NLP libraries + * `docker pull pytorchignite/nlp:latest` +- [main/Dockerfile.apex](main/Dockerfile.apex): multi-stage NVIDIA/apex build with latest Pytorch, Ignite image with minimal dependencies + * `docker pull pytorchignite/apex:latest` +- [main/Dockerfile.apex-vision](main/Dockerfile.nlp): base apex with useful computer vision libraries + * `docker pull pytorchignite/apex-vision:latest` +- [main/Dockerfile.apex-nlp](main/Dockerfile.nlp): base apex with useful NLP libraries + * `docker pull pytorchignite/apex-nlp:latest` +## How to use + `docker run --rm -it pytorchignite/base:latest` \ No newline at end of file diff --git a/docker/apex-vision/Dockerfile.apex b/docker/apex-vision/Dockerfile.apex deleted file mode 100644 index 5946c2a46f4c..000000000000 --- a/docker/apex-vision/Dockerfile.apex +++ /dev/null @@ -1,61 +0,0 @@ -#multi-stage build -#1/ building apex with pytorch:1.6.0-cuda10.1-cudnn7-devel -FROM pytorch/pytorch:1.6.0-cuda10.1-cudnn7-devel AS apex-builder - -ARG ARG_TORCH_CUDA_ARCH_LIST="6.0;6.1;6.2;7.0;7.5" -ENV TORCH_CUDA_ARCH_LIST=$ARG_TORCH_CUDA_ARCH_LIST - -#install git -RUN apt-get update && apt-get install -y --no-install-recommends \ - git && \ - rm -rf /var/lib/apt/lists/* - -#building apex -RUN echo "Setup NVIDIA Apex" && \ - tmp_apex_path="/tmp/apex" && \ - rm -rf $tmp_apex_path && \ - git clone https://github.com/NVIDIA/apex $tmp_apex_path && \ - cd $tmp_apex_path && \ - pip wheel --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" . - -#2/ build the runtime image -FROM pytorch/pytorch:latest - -COPY --from=apex-builder /tmp/apex/apex-0.1-cp37-cp37m-linux_x86_64.whl apex-0.1-cp37-cp37m-linux_x86_64.whl -RUN pip install --no-cache-dir apex-0.1-cp37-cp37m-linux_x86_64.whl && \ - rm apex-0.1-cp37-cp37m-linux_x86_64.whl - -#install tzdata / opencv dependencies / git -RUN apt-get update && \ - ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime && \ - apt-get install -y tzdata && \ - dpkg-reconfigure --frontend noninteractive tzdata && \ - apt-get -y install --no-install-recommends libglib2.0 \ - libsm6 \ - libxext6 \ - libxrender-dev \ - git && \ - rm -rf /var/lib/apt/lists/* - -#install ignite vison dependencies -RUN pip install --upgrade --no-cache-dir albumentations \ - image-dataset-viz \ - numpy \ - opencv-python \ - py_config_runner \ - pytorch-ignite \ - pillow \ - tensorboard \ - tqdm \ - "trains>=0.15.0" - -#create a non-privileged docker user (for debian) -RUN groupadd -g 61000 ignite \ - && useradd -g 61000 -l -M \ - -s /sbin/nologin -u 61000 ignite - -RUN chown -R ignite:ignite /workspace - -USER ignite - -ENTRYPOINT ["/bin/bash"] \ No newline at end of file diff --git a/docker/main/Dockerfile.apex b/docker/main/Dockerfile.apex new file mode 100644 index 000000000000..4b55c4b5db62 --- /dev/null +++ b/docker/main/Dockerfile.apex @@ -0,0 +1,49 @@ +# Multi-stage build +# 1/Building apex with pytorch:1.6.0-cuda10.1-cudnn7-devel +FROM pytorch/pytorch:1.6.0-cuda10.1-cudnn7-devel AS apex-builder + +ARG ARG_TORCH_CUDA_ARCH_LIST="6.0;6.1;6.2;7.0;7.5" +ENV TORCH_CUDA_ARCH_LIST=$ARG_TORCH_CUDA_ARCH_LIST + +# Install git +RUN apt-get update && apt-get install -y --no-install-recommends git && \ + rm -rf /var/lib/apt/lists/* + +# Build apex +RUN echo "Setup NVIDIA Apex" && \ + tmp_apex_path="/tmp/apex" && \ + rm -rf $tmp_apex_path && \ + git clone https://github.com/NVIDIA/apex $tmp_apex_path && \ + cd $tmp_apex_path && \ + pip wheel --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" . + +# 2/ Build the runtime image +FROM pytorch/pytorch:latest + +COPY --from=apex-builder /tmp/apex/apex-0.1-cp37-cp37m-linux_x86_64.whl apex-0.1-cp37-cp37m-linux_x86_64.whl +RUN pip install --no-cache-dir apex-0.1-cp37-cp37m-linux_x86_64.whl && \ + rm apex-0.1-cp37-cp37m-linux_x86_64.whl + +# Install tzdata / git +RUN apt-get update && \ + ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime && \ + apt-get install -y tzdata && \ + dpkg-reconfigure --frontend noninteractive tzdata && \ + apt-get -y install --no-install-recommends git && \ + rm -rf /var/lib/apt/lists/* + +# Ignite main dependencies +RUN pip install --upgrade --no-cache-dir pytorch-ignite \ + tensorboard \ + tqdm + +# Checkout Ignite examples only +RUN mkdir -p pytorch-ignite-examples && \ + cd pytorch-ignite-examples && \ + git init && \ + git config core.sparsecheckout true && \ + echo examples >> .git/info/sparse-checkout && \ + git remote add -f origin https://github.com/pytorch/ignite.git && \ + git pull origin master + +ENTRYPOINT ["/bin/bash"] \ No newline at end of file diff --git a/docker/main/Dockerfile.apex-nlp b/docker/main/Dockerfile.apex-nlp new file mode 100644 index 000000000000..02340e60d889 --- /dev/null +++ b/docker/main/Dockerfile.apex-nlp @@ -0,0 +1,10 @@ +# Dockerfile.apex-nlp +FROM pytorchignite/apex + +# Ignite NLP dependencies +RUN pip install --upgrade --no-cache-dir torchtext \ + transformers \ + spacy \ + nltk + +ENTRYPOINT ["/bin/bash"] diff --git a/docker/main/Dockerfile.apex-vision b/docker/main/Dockerfile.apex-vision new file mode 100644 index 000000000000..637b149b10ac --- /dev/null +++ b/docker/main/Dockerfile.apex-vision @@ -0,0 +1,21 @@ +# Dockerfile.apex-vision +FROM pytorchignite/apex + +# Install opencv dependencies +RUN apt-get update && \ + apt-get -y install --no-install-recommends libglib2.0 \ + libsm6 \ + libxext6 \ + libxrender-dev && \ + rm -rf /var/lib/apt/lists/* + +# Ignite vision dependencies +RUN pip install --upgrade --no-cache-dir albumentations \ + image-dataset-viz \ + numpy \ + opencv-python \ + py_config_runner \ + pillow \ + "trains>=0.15.0" + +ENTRYPOINT ["/bin/bash"] diff --git a/docker/main/Dockerfile.base b/docker/main/Dockerfile.base new file mode 100644 index 000000000000..758c3a27aee8 --- /dev/null +++ b/docker/main/Dockerfile.base @@ -0,0 +1,25 @@ +# Dockerfile.base +FROM pytorch/pytorch:latest + +# Install tzdata / git +RUN apt-get update && \ + ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime && \ + apt-get install -y tzdata && \ + dpkg-reconfigure --frontend noninteractive tzdata && \ + apt-get -y install --no-install-recommends git && \ + rm -rf /var/lib/apt/lists/* + +# Ignite main dependencies +RUN pip install --upgrade --no-cache-dir pytorch-ignite \ + tensorboard \ + tqdm +# Checkout Ignite examples only +RUN mkdir -p pytorch-ignite-examples && \ + cd pytorch-ignite-examples && \ + git init && \ + git config core.sparsecheckout true && \ + echo examples >> .git/info/sparse-checkout && \ + git remote add -f origin https://github.com/pytorch/ignite.git && \ + git pull origin master + +ENTRYPOINT ["/bin/bash"] \ No newline at end of file diff --git a/docker/main/Dockerfile.nlp b/docker/main/Dockerfile.nlp new file mode 100644 index 000000000000..eabf299ae5cc --- /dev/null +++ b/docker/main/Dockerfile.nlp @@ -0,0 +1,10 @@ +# Dockerfile.nlp +FROM pytorchignite/base:latest + +# Ignite NLP dependencies +RUN pip install --upgrade --no-cache-dir torchtext \ + transformers \ + spacy \ + nltk + +ENTRYPOINT ["/bin/bash"] \ No newline at end of file diff --git a/docker/main/Dockerfile.vision b/docker/main/Dockerfile.vision new file mode 100644 index 000000000000..65131c087c12 --- /dev/null +++ b/docker/main/Dockerfile.vision @@ -0,0 +1,21 @@ +# Dockerfile.vision +FROM pytorchignite/base:latest + +# Install opencv dependencies +RUN apt-get update && \ + apt-get -y install --no-install-recommends libglib2.0 \ + libsm6 \ + libxext6 \ + libxrender-dev && \ + rm -rf /var/lib/apt/lists/* + +# Ignite vision dependencies +RUN pip install --upgrade --no-cache-dir albumentations \ + image-dataset-viz \ + numpy \ + opencv-python \ + py_config_runner \ + pillow \ + "trains>=0.15.0" + +ENTRYPOINT ["/bin/bash"] \ No newline at end of file diff --git a/docker/vision/Dockerfile b/docker/vision/Dockerfile deleted file mode 100644 index 189e5096883c..000000000000 --- a/docker/vision/Dockerfile +++ /dev/null @@ -1,36 +0,0 @@ -FROM pytorch/pytorch:latest - -#install tzdata / opencv dependencies / git -RUN apt-get update && \ - ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime && \ - apt-get install -y tzdata && \ - dpkg-reconfigure --frontend noninteractive tzdata && \ - apt-get -y install --no-install-recommends libglib2.0 \ - libsm6 \ - libxext6 \ - libxrender-dev \ - git && \ - rm -rf /var/lib/apt/lists/* - -#ignite vision dependencies -RUN pip install --upgrade --no-cache-dir albumentations \ - image-dataset-viz \ - numpy \ - opencv-python \ - py_config_runner \ - pytorch-ignite \ - pillow \ - tensorboard \ - tqdm \ - "trains>=0.15.0" - -#create a non-privileged docker user (for debian) -RUN groupadd -g 61000 ignite \ - && useradd -g 61000 -l -M \ - -s /sbin/nologin -u 61000 ignite - -RUN chown -R ignite:ignite /workspace - -USER ignite - -ENTRYPOINT ["/bin/bash"] \ No newline at end of file From 8ab687af6bfde72482cbd04ac3ea23ecf164d1ea Mon Sep 17 00:00:00 2001 From: vfdev Date: Tue, 18 Aug 2020 23:49:35 +0200 Subject: [PATCH 5/5] Update README.md --- docker/README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index d16b8a7e1f5f..2351104d47d4 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,6 +1,9 @@ # Docker for users + We provide Dockerfiles in order to build containerized execution environment that ease the use of Ignite for computer vision and NLP tasks. + ## Installation + - [main/Dockerfile.base](main/Dockerfile.base): latest stable PyTorch, Ignite with minimal dependencies * `docker pull pytorchignite/base:latest` - [main/Dockerfile.vision](main/Dockerfile.vision): base image with useful computer vision libraries @@ -13,5 +16,9 @@ We provide Dockerfiles in order to build containerized execution environment tha * `docker pull pytorchignite/apex-vision:latest` - [main/Dockerfile.apex-nlp](main/Dockerfile.nlp): base apex with useful NLP libraries * `docker pull pytorchignite/apex-nlp:latest` + ## How to use - `docker run --rm -it pytorchignite/base:latest` \ No newline at end of file + +```bash +docker run --rm -it -v $PWD:/workspace/project --network=host --shm-size 16G pytorchignite/base:latest +```