From 51bc53580dab20c52b41c4c615293c14f404e732 Mon Sep 17 00:00:00 2001 From: liqun Fu Date: Tue, 4 Jun 2024 11:06:28 -0700 Subject: [PATCH] Update to onnx 1.16.1 (#20702) --- cgmanifests/generated/cgmanifest.json | 4 +- cmake/deps.txt | 2 +- cmake/external/onnx | 2 +- cmake/patches/onnx/onnx.patch | 100 ++---------------- .../models/llama/requirements.txt | 4 +- .../transformers/models/phi2/requirements.txt | 2 +- .../models/whisper/requirements.txt | 2 +- onnxruntime/test/python/requirements.txt | 2 +- .../templates/download-deps.yml | 4 +- .../python/cpu/scripts/requirements.txt | 2 +- .../python/cpu/scripts/requirements.txt | 2 +- .../python/cuda/scripts/requirements.txt | 2 +- .../docker/scripts/manylinux/requirements.txt | 2 +- .../linux/docker/scripts/requirements.txt | 2 +- 14 files changed, 22 insertions(+), 110 deletions(-) diff --git a/cgmanifests/generated/cgmanifest.json b/cgmanifests/generated/cgmanifest.json index d728ae7974..78db7d735d 100644 --- a/cgmanifests/generated/cgmanifest.json +++ b/cgmanifests/generated/cgmanifest.json @@ -26,7 +26,7 @@ "component": { "type": "git", "git": { - "commitHash": "990217f043af7222348ca8f0301e17fa7b841781", + "commitHash": "595228d99e3977ac27cb79d5963adda262af99ad", "repositoryUrl": "https://github.com/onnx/onnx.git" }, "comments": "git submodule at cmake/external/onnx" @@ -216,7 +216,7 @@ "component": { "type": "git", "git": { - "commitHash": "eb43908b02a296ea0594432f06e9d3fac288d672", + "commitHash": "06adf4461ac84035bee658c6cf5df39f7ab6071d", "repositoryUrl": "https://github.com/onnx/onnx-tensorrt.git" }, "comments": "onnx_tensorrt" diff --git a/cmake/deps.txt b/cmake/deps.txt index d4d19dea08..88c1881ad8 100644 --- a/cmake/deps.txt +++ b/cmake/deps.txt @@ -36,7 +36,7 @@ microsoft_wil;https://github.com/microsoft/wil/archive/refs/tags/v1.0.230629.1.z mimalloc;https://github.com/microsoft/mimalloc/archive/refs/tags/v2.1.1.zip;d5ee7d34223d0567892db5179849939c8769dc41 mp11;https://github.com/boostorg/mp11/archive/refs/tags/boost-1.82.0.zip;9bc9e01dffb64d9e0773b2e44d2f22c51aace063 neural_speed;https://github.com/intel/neural-speed/archive/refs/tags/v0.3.zip;5ec64e3071edc7347ebd8a81679cf06e2bb9b851 -onnx;https://github.com/onnx/onnx/archive/refs/tags/v1.16.0.zip;a6d8b619459fb4657f8bec7d1c6d95ad6d4c069d +onnx;https://github.com/onnx/onnx/archive/refs/tags/v1.16.1.zip;2eb9198bb352757d5ff13977cbe0634898e0837c #use the latest commit of 10.0-GA onnx_tensorrt;https://github.com/onnx/onnx-tensorrt/archive/06adf4461ac84035bee658c6cf5df39f7ab6071d.zip;46dceef659d75d276e7914a8057c2282269d5e7b protobuf;https://github.com/protocolbuffers/protobuf/archive/refs/tags/v21.12.zip;7cf2733949036c7d52fda017badcab093fe73bfa diff --git a/cmake/external/onnx b/cmake/external/onnx index 990217f043..595228d99e 160000 --- a/cmake/external/onnx +++ b/cmake/external/onnx @@ -1 +1 @@ -Subproject commit 990217f043af7222348ca8f0301e17fa7b841781 +Subproject commit 595228d99e3977ac27cb79d5963adda262af99ad diff --git a/cmake/patches/onnx/onnx.patch b/cmake/patches/onnx/onnx.patch index fe8d6622bc..162d33581a 100644 --- a/cmake/patches/onnx/onnx.patch +++ b/cmake/patches/onnx/onnx.patch @@ -36,15 +36,15 @@ index b847798e..a6c31904 100644 --- a/onnx/common/file_utils.h +++ b/onnx/common/file_utils.h @@ -6,7 +6,6 @@ - + #pragma once - + -#include #include #include - + @@ -17,8 +16,7 @@ namespace ONNX_NAMESPACE { - + template void LoadProtoFromPath(const std::string proto_path, T& proto) { - std::filesystem::path proto_u8_path = std::filesystem::u8path(proto_path); @@ -53,42 +53,6 @@ index b847798e..a6c31904 100644 if (!proto_stream.good()) { fail_check("Unable to open proto file: ", proto_path, ". Please check if it is a valid proto. "); } -diff --git a/onnx/defs/quantization/defs.cc b/onnx/defs/quantization/defs.cc -index 70b4a4db..98c11545 100644 ---- a/onnx/defs/quantization/defs.cc -+++ b/onnx/defs/quantization/defs.cc -@@ -200,6 +200,9 @@ ONNX_OPERATOR_SET_SCHEMA( - .SetDoc(DequantizeLinear_ver21_doc) - .TypeAndShapeInferenceFunction([](ONNX_NAMESPACE::InferenceContext& ctx) { - propagateElemTypeFromInputToOutput(ctx, 1, 0); -+ if (!hasInputShape(ctx, 0)) { -+ return; -+ } - auto& input_shape = getInputShape(ctx, 0); - updateOutputShape(ctx, 0, input_shape); - })); -diff --git a/onnx/defs/quantization/old.cc b/onnx/defs/quantization/old.cc -index 3f2d6384..d2f7cfd8 100644 ---- a/onnx/defs/quantization/old.cc -+++ b/onnx/defs/quantization/old.cc -@@ -130,6 +130,9 @@ ONNX_OPERATOR_SET_SCHEMA( - .SetDoc(DequantizeLinear_ver19_doc) - .TypeAndShapeInferenceFunction([](ONNX_NAMESPACE::InferenceContext& ctx) { - propagateElemTypeFromInputToOutput(ctx, 1, 0); -+ if (!hasInputShape(ctx, 0)) { -+ return; -+ } - auto& input_shape = getInputShape(ctx, 0); - updateOutputShape(ctx, 0, input_shape); - })); -@@ -181,7 +184,6 @@ ONNX_OPERATOR_SET_SCHEMA( - if (!hasInputShape(ctx, 0)) { - return; - } -- - auto& input_shape = getInputShape(ctx, 0); - updateOutputShape(ctx, 0, input_shape); - })); diff --git a/onnx/onnx_pb.h b/onnx/onnx_pb.h index 0aab3e26..398ac2d6 100644 --- a/onnx/onnx_pb.h @@ -96,7 +60,7 @@ index 0aab3e26..398ac2d6 100644 @@ -47,10 +47,28 @@ #define ONNX_API ONNX_IMPORT #endif - + +#if defined(__GNUC__) +#pragma GCC diagnostic push + @@ -116,61 +80,9 @@ index 0aab3e26..398ac2d6 100644 #else #include "onnx/onnx.pb.h" #endif - + +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif + #endif // ! ONNX_ONNX_PB_H -diff --git a/onnx/shape_inference/implementation.cc b/onnx/shape_inference/implementation.cc -index fab1faf2..8723dcd4 100644 ---- a/onnx/shape_inference/implementation.cc -+++ b/onnx/shape_inference/implementation.cc -@@ -488,29 +488,29 @@ class ShapeInferenceImplBase { - ProcessCall(n, *(iter->second), ctx); - } else { - has_unsupported_op = true; -+ return; - } - } else { - has_unsupported_op = true; -+ return; - } -- if (!has_unsupported_op) { -- for (int i = 0; i < n.output_size(); ++i) { -- // skip type and shape propagation for missing optional outputs. -- if (!n.output(i).empty()) -- UpdateType(n.output(i), ctx.getOutputType(i)); -- } -- // Constant values are tracked to improve inference/checking for subsequent nodes. -- ProcessConstant(n); -- // If data-propagation is enabled, partial-evaluation (aka data-propagation) is performed -- // to improve inference/checking for subsequent nodes. -- if (options.enable_data_propagation && schema && schema->has_data_propagation_function()) { -- if (generated_shape_data_by_name == nullptr) { -- fail_shape_inference( -- "Container for generated shape data cannot be nullptr when enable_data_propagation option is set."); -- } -- DataPropagationContextImpl data_propagation_ctx( -- n, value_types_by_name, input_data_by_name, *generated_shape_data_by_name); -- schema->GetDataPropagationFunction()(data_propagation_ctx); -+ for (int i = 0; i < n.output_size(); ++i) { -+ // skip type and shape propagation for missing optional outputs. -+ if (!n.output(i).empty()) -+ UpdateType(n.output(i), ctx.getOutputType(i)); -+ } -+ // Constant values are tracked to improve inference/checking for subsequent nodes. -+ ProcessConstant(n); -+ // If data-propagation is enabled, partial-evaluation (aka data-propagation) is performed -+ // to improve inference/checking for subsequent nodes. -+ if (options.enable_data_propagation && schema && schema->has_data_propagation_function()) { -+ if (generated_shape_data_by_name == nullptr) { -+ fail_shape_inference( -+ "Container for generated shape data cannot be nullptr when enable_data_propagation option is set."); - } -+ DataPropagationContextImpl data_propagation_ctx( -+ n, value_types_by_name, input_data_by_name, *generated_shape_data_by_name); -+ schema->GetDataPropagationFunction()(data_propagation_ctx); - } - } - ONNX_CATCH(const ONNX_NAMESPACE::InferenceError& ex) { diff --git a/onnxruntime/python/tools/transformers/models/llama/requirements.txt b/onnxruntime/python/tools/transformers/models/llama/requirements.txt index ce4b3f6a09..388025165f 100644 --- a/onnxruntime/python/tools/transformers/models/llama/requirements.txt +++ b/onnxruntime/python/tools/transformers/models/llama/requirements.txt @@ -1,7 +1,7 @@ optimum>=1.14.1 transformers>=4.33.2,<= 4.37.2 torch>=2.2.0 -onnx==1.16.0 +onnx==1.16.1 datasets>=2.8.0 protobuf==3.20.2 -psutil \ No newline at end of file +psutil diff --git a/onnxruntime/python/tools/transformers/models/phi2/requirements.txt b/onnxruntime/python/tools/transformers/models/phi2/requirements.txt index 0b2ea0df93..c82022e798 100644 --- a/onnxruntime/python/tools/transformers/models/phi2/requirements.txt +++ b/onnxruntime/python/tools/transformers/models/phi2/requirements.txt @@ -1,3 +1,3 @@ -onnx==1.16.0 +onnx==1.16.1 transformers>=4.36.2 onnxscript>=0.1.0.dev20240126 diff --git a/onnxruntime/python/tools/transformers/models/whisper/requirements.txt b/onnxruntime/python/tools/transformers/models/whisper/requirements.txt index a722c13e80..689b14ea9a 100644 --- a/onnxruntime/python/tools/transformers/models/whisper/requirements.txt +++ b/onnxruntime/python/tools/transformers/models/whisper/requirements.txt @@ -7,7 +7,7 @@ soundfile librosa optimum onnxruntime-extensions>=0.9.0 -onnx==1.16.0 +onnx==1.16.1 protobuf==3.20.2 numpy==1.23.3 psutil diff --git a/onnxruntime/test/python/requirements.txt b/onnxruntime/test/python/requirements.txt index 5d8e356d0f..741c411ce5 100644 --- a/onnxruntime/test/python/requirements.txt +++ b/onnxruntime/test/python/requirements.txt @@ -1,2 +1,2 @@ -onnx==1.16.0 +onnx==1.16.1 pytest diff --git a/tools/ci_build/github/azure-pipelines/templates/download-deps.yml b/tools/ci_build/github/azure-pipelines/templates/download-deps.yml index 9d0a8b42a2..e7b230008d 100644 --- a/tools/ci_build/github/azure-pipelines/templates/download-deps.yml +++ b/tools/ci_build/github/azure-pipelines/templates/download-deps.yml @@ -11,7 +11,7 @@ steps: packageType: upack feed: '/7424c8e4-5c62-490e-95c4-79446f31017c' definition: '517c4f6f-5437-4392-a70d-4f15ec5be2f0' - version: 1.0.155 + version: 1.0.156 downloadPath: $(Build.BinariesDirectory)/deps # The private ADO project @@ -22,7 +22,7 @@ steps: packageType: upack feed: '/4c7631f5-24c0-4307-8822-1aa8f180c325' definition: 'fd9dd5ad-b73e-4678-890e-edcf680dbc1a' - version: 1.0.155 + version: 1.0.156 downloadPath: $(Build.BinariesDirectory)/deps # You can add more ADO accounts at here. diff --git a/tools/ci_build/github/linux/docker/inference/aarch64/python/cpu/scripts/requirements.txt b/tools/ci_build/github/linux/docker/inference/aarch64/python/cpu/scripts/requirements.txt index 8f56ee18cc..cc47718f78 100644 --- a/tools/ci_build/github/linux/docker/inference/aarch64/python/cpu/scripts/requirements.txt +++ b/tools/ci_build/github/linux/docker/inference/aarch64/python/cpu/scripts/requirements.txt @@ -5,7 +5,7 @@ mypy pytest setuptools>=68.2.2 wheel -onnx==1.16.0 +onnx==1.16.1 protobuf==4.21.12 sympy==1.12 flatbuffers diff --git a/tools/ci_build/github/linux/docker/inference/x86_64/python/cpu/scripts/requirements.txt b/tools/ci_build/github/linux/docker/inference/x86_64/python/cpu/scripts/requirements.txt index 8f56ee18cc..cc47718f78 100644 --- a/tools/ci_build/github/linux/docker/inference/x86_64/python/cpu/scripts/requirements.txt +++ b/tools/ci_build/github/linux/docker/inference/x86_64/python/cpu/scripts/requirements.txt @@ -5,7 +5,7 @@ mypy pytest setuptools>=68.2.2 wheel -onnx==1.16.0 +onnx==1.16.1 protobuf==4.21.12 sympy==1.12 flatbuffers diff --git a/tools/ci_build/github/linux/docker/inference/x86_64/python/cuda/scripts/requirements.txt b/tools/ci_build/github/linux/docker/inference/x86_64/python/cuda/scripts/requirements.txt index 8f56ee18cc..cc47718f78 100644 --- a/tools/ci_build/github/linux/docker/inference/x86_64/python/cuda/scripts/requirements.txt +++ b/tools/ci_build/github/linux/docker/inference/x86_64/python/cuda/scripts/requirements.txt @@ -5,7 +5,7 @@ mypy pytest setuptools>=68.2.2 wheel -onnx==1.16.0 +onnx==1.16.1 protobuf==4.21.12 sympy==1.12 flatbuffers diff --git a/tools/ci_build/github/linux/docker/scripts/manylinux/requirements.txt b/tools/ci_build/github/linux/docker/scripts/manylinux/requirements.txt index 80eccb68eb..bdae9d72a1 100644 --- a/tools/ci_build/github/linux/docker/scripts/manylinux/requirements.txt +++ b/tools/ci_build/github/linux/docker/scripts/manylinux/requirements.txt @@ -5,7 +5,7 @@ mypy pytest setuptools>=68.2.2 wheel -onnx==1.16.0 +onnx==1.16.1 protobuf==4.21.12 sympy==1.12 flatbuffers diff --git a/tools/ci_build/github/linux/docker/scripts/requirements.txt b/tools/ci_build/github/linux/docker/scripts/requirements.txt index e20e433cd3..3e619ea3df 100644 --- a/tools/ci_build/github/linux/docker/scripts/requirements.txt +++ b/tools/ci_build/github/linux/docker/scripts/requirements.txt @@ -6,7 +6,7 @@ mypy pytest setuptools==69.0.3 wheel==0.42.0 -onnx==1.16.0 +onnx==1.16.1 argparse sympy==1.12 flatbuffers