diff --git a/examples/onnxruntime/training/docker/Dockerfile-ort1.14.1-cu116 b/examples/onnxruntime/training/docker/Dockerfile-ort1.14.1-cu116 deleted file mode 100644 index 15df7c352f..0000000000 --- a/examples/onnxruntime/training/docker/Dockerfile-ort1.14.1-cu116 +++ /dev/null @@ -1,66 +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 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 ffmpeg && \ - 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 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.14.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.15.1-cu118 b/examples/onnxruntime/training/docker/Dockerfile-ort1.15.1-cu118 deleted file mode 100644 index 2d1306e1a3..0000000000 --- a/examples/onnxruntime/training/docker/Dockerfile-ort1.15.1-cu118 +++ /dev/null @@ -1,76 +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.8.0-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 PYTHON_VERSION=3.9 -ARG TORCH_CUDA_VERSION=cu118 -ARG TORCH_VERSION=2.0.0 -ARG TORCHVISION_VERSION=0.15.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 ffmpeg && \ - 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.15.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 diff --git a/examples/onnxruntime/training/docker/Dockerfile-ort1.16.3-cu118 b/examples/onnxruntime/training/docker/Dockerfile-ort1.17.1-cu118 similarity index 97% rename from examples/onnxruntime/training/docker/Dockerfile-ort1.16.3-cu118 rename to examples/onnxruntime/training/docker/Dockerfile-ort1.17.1-cu118 index 8b6a8c38bd..ee58b71114 100644 --- a/examples/onnxruntime/training/docker/Dockerfile-ort1.16.3-cu118 +++ b/examples/onnxruntime/training/docker/Dockerfile-ort1.17.1-cu118 @@ -65,7 +65,7 @@ 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.3 -f https://download.onnxruntime.ai/onnxruntime_stable_cu118.html +RUN $PYTHON_EXE -m pip install onnxruntime-training==1.17.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 diff --git a/optimum/onnxruntime/modeling_seq2seq.py b/optimum/onnxruntime/modeling_seq2seq.py index e4a1b02007..a2d0e2f8aa 100644 --- a/optimum/onnxruntime/modeling_seq2seq.py +++ b/optimum/onnxruntime/modeling_seq2seq.py @@ -918,9 +918,9 @@ def _from_pretrained( attribute_name_to_filename = { "last_encoder_model_name": encoder_path.name, "last_decoder_model_name": decoder_path.name if use_merged is False else None, - "last_decoder_with_past_model_name": decoder_with_past_path.name - if (use_merged is False and use_cache is True) - else None, + "last_decoder_with_past_model_name": ( + decoder_with_past_path.name if (use_merged is False and use_cache is True) else None + ), "last_decoder_merged_name": decoder_merged_path.name if use_merged is True else None, } paths = {} diff --git a/optimum/onnxruntime/runs/__init__.py b/optimum/onnxruntime/runs/__init__.py index e77e2cab21..1d98294934 100644 --- a/optimum/onnxruntime/runs/__init__.py +++ b/optimum/onnxruntime/runs/__init__.py @@ -65,9 +65,9 @@ def __init__(self, run_config): ref_keys=run_config["dataset"]["ref_keys"], task_args=run_config["task_args"], static_quantization=self.static_quantization, - num_calibration_samples=run_config["calibration"]["num_calibration_samples"] - if self.static_quantization - else None, + num_calibration_samples=( + run_config["calibration"]["num_calibration_samples"] if self.static_quantization else None + ), config=trfs_model.config, max_eval_samples=run_config["max_eval_samples"], )