From 6627d2ff467416eb499f3ce71b41b4f22920f5b4 Mon Sep 17 00:00:00 2001 From: JingyaHuang Date: Thu, 12 Oct 2023 12:45:29 +0000 Subject: [PATCH] update dockerfiles --- .../docker/Dockerfile-ort1.13.1-cu116 | 67 ---------------- .../docker/Dockerfile-ort1.16.1-cu118 | 76 +++++++++++++++++++ 2 files changed, 76 insertions(+), 67 deletions(-) delete mode 100644 examples/onnxruntime/training/docker/Dockerfile-ort1.13.1-cu116 create mode 100644 examples/onnxruntime/training/docker/Dockerfile-ort1.16.1-cu118 diff --git a/examples/onnxruntime/training/docker/Dockerfile-ort1.13.1-cu116 b/examples/onnxruntime/training/docker/Dockerfile-ort1.13.1-cu116 deleted file mode 100644 index 84041a42425..00000000000 --- a/examples/onnxruntime/training/docker/Dockerfile-ort1.13.1-cu116 +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env python -# coding=utf-8 -# Copyright 2023 The HuggingFace Team All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Use nvidia/cuda image -FROM nvidia/cuda:11.6.2-cudnn8-devel-ubuntu20.04 -CMD nvidia-smi - -# Ignore interactive questions during `docker build` -ENV DEBIAN_FRONTEND noninteractive - -# Bash shell -RUN chsh -s /bin/bash -SHELL ["/bin/bash", "-c"] - -# Versions -ARG TORCH_CUDA_VERSION=cu116 -ARG ONNXRUNTIME_TRAINING_VERSION=1.12.0 -ARG TORCH_VERSION=1.13.1 -ARG TORCHVISION_VERSION=0.14.1 - -# Install and update tools to minimize security vulnerabilities -RUN apt-get update -RUN apt-get install -y software-properties-common wget apt-utils patchelf git libprotobuf-dev protobuf-compiler cmake \ - bzip2 ca-certificates libglib2.0-0 libxext6 libsm6 libxrender1 mercurial subversion libopenmpi-dev && \ - apt-get clean -RUN unattended-upgrade -RUN apt-get autoremove -y - -# Install Pythyon (3.8 as default) -RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1 -RUN apt-get install -y python3-pip -RUN update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 -RUN pip install -U pip -RUN pip install pygit2 pgzip - -# (Optional) Intall test dependencies -RUN pip install git+https://github.com/huggingface/transformers -RUN pip install datasets accelerate evaluate coloredlogs absl-py rouge_score seqeval scipy sacrebleu nltk scikit-learn parameterized sentencepiece -RUN pip install fairscale deepspeed mpi4py -# RUN pip install optuna ray sigopt wandb - -# Install onnxruntime-training dependencies -RUN pip install onnx ninja -RUN pip install torch==${TORCH_VERSION}+${TORCH_CUDA_VERSION} torchvision==${TORCHVISION_VERSION} -f https://download.pytorch.org/whl/cu116/torch_stable.html -RUN pip install onnxruntime-training==1.13.1 -f https://download.onnxruntime.ai/onnxruntime_stable_cu116.html -RUN pip install torch-ort -RUN pip install --upgrade protobuf==3.20.2 - -ARG TORCH_CUDA_ARCH_LIST="5.2 6.0 6.1 7.0 7.5 8.0 8.6+PTX" -RUN python -m torch_ort.configure - -WORKDIR . - -CMD ["/bin/bash"] \ No newline at end of file diff --git a/examples/onnxruntime/training/docker/Dockerfile-ort1.16.1-cu118 b/examples/onnxruntime/training/docker/Dockerfile-ort1.16.1-cu118 new file mode 100644 index 00000000000..3f6b8335923 --- /dev/null +++ b/examples/onnxruntime/training/docker/Dockerfile-ort1.16.1-cu118 @@ -0,0 +1,76 @@ +#!/usr/bin/env python +# coding=utf-8 +# Copyright 2023 The HuggingFace Team All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Use nvidia/cuda image +FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu20.04 +CMD nvidia-smi + +# Ignore interactive questions during `docker build` +ENV DEBIAN_FRONTEND noninteractive + +# Versions +ARG PYTHON_VERSION=3.10 +ARG TORCH_CUDA_VERSION=cu118 +ARG TORCH_VERSION=2.0.0 +ARG TORCHVISION_VERSION=0.15.1 + +# Bash shell +RUN chsh -s /bin/bash +SHELL ["/bin/bash", "-c"] + +# Install and update tools to minimize security vulnerabilities +RUN apt-get update +RUN apt-get install -y software-properties-common wget apt-utils patchelf git libprotobuf-dev protobuf-compiler cmake \ + bzip2 ca-certificates libglib2.0-0 libxext6 libsm6 libxrender1 mercurial subversion libopenmpi-dev && \ + apt-get clean +RUN unattended-upgrade +RUN apt-get autoremove -y + +# Install miniconda (comes with python 3.9 default) +ARG BUILD_USER=onnxruntimedev +ARG MINICONDA_PREFIX=/home/$BUILD_USER/miniconda3 +RUN apt-get install curl + +ARG CONDA_URL=https://repo.anaconda.com/miniconda/Miniconda3-py37_4.9.2-Linux-x86_64.sh +RUN curl -fSsL --insecure ${CONDA_URL} -o install-conda.sh && \ + /bin/bash ./install-conda.sh -b -p $MINICONDA_PREFIX && \ + $MINICONDA_PREFIX/bin/conda clean -ya && \ + $MINICONDA_PREFIX/bin/conda install -y python=${PYTHON_VERSION} + +ENV PATH=$MINICONDA_PREFIX/bin:${PATH} + +ARG PYTHON_EXE=$MINICONDA_PREFIX/bin/python + +# (Optional) Intall test dependencies +RUN $PYTHON_EXE -m pip install git+https://github.com/huggingface/transformers +RUN $PYTHON_EXE -m pip install datasets accelerate evaluate coloredlogs absl-py rouge_score seqeval scipy sacrebleu nltk scikit-learn parameterized sentencepiece +RUN $PYTHON_EXE -m pip install deepspeed mpi4py +# RUN $PYTHON_EXE -m pip install optuna ray sigopt wandb + +# PyTorch +RUN $PYTHON_EXE -m pip install onnx ninja +RUN $PYTHON_EXE -m pip install torch==${TORCH_VERSION} torchvision==${TORCHVISION_VERSION} -f https://download.pytorch.org/whl/${TORCH_CUDA_VERSION} + +# ORT Module +RUN $PYTHON_EXE -m pip install onnxruntime-training==1.16.1 -f https://download.onnxruntime.ai/onnxruntime_stable_cu118.html +RUN $PYTHON_EXE -m pip install torch-ort +ENV TORCH_CUDA_ARCH_LIST="5.2 6.0 6.1 7.0 7.5 8.0 8.6+PTX" +RUN $PYTHON_EXE -m pip install --upgrade protobuf==3.20.2 +RUN $PYTHON_EXE -m torch_ort.configure + +WORKDIR . + +CMD ["/bin/bash"] \ No newline at end of file