8000 Docker for users #1214 by fco-dv · Pull Request #1218 · pytorch/ignite · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Docker for users #1214 #1218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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

```bash
docker run --rm -it -v $PWD:/workspace/project --network=host --shm-size 16G pytorchignite/base:latest
```
49 changes: 49 additions & 0 deletions docker/main/Dockerfile.apex
Original file line number Diff line number Diff line change
@@ -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"]
10 changes: 10 additions & 0 deletions docker/main/Dockerfile.apex-nlp
Original file line number Diff line number Diff line change
@@ -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"]
21 changes: 21 additions & 0 deletions docker/main/Dockerfile.apex-vision
Original file line number Diff line number Diff line change
@@ -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"]
25 changes: 25 additions & 0 deletions docker/main/Dockerfile.base
Original file line number Diff line number Diff line change
@@ -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"]
10 changes: 10 additions & 0 deletions docker/main/Dockerfile.nlp
Original file line number Diff line number Diff line change
@@ -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"]
21 changes: 21 additions & 0 deletions docker/main/Dockerfile.vision
Original file line number Diff line number Diff line change
@@ -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"]
0