SHA256
1
0
forked from pool/python-onnx

Accepting request 821861 from home:mslacken:ml

- reorganized package in order to have shared library support.
  Additional  packages are:
  * onnx-devel
  * libonnxifi_dummy
  * libonnx
  * onnx-devel
  As no so versions for the shared libraries are available, there
  is not a explicit dependency for the shared libraries.
  The archive file libonnxifi_loader.a is explicitely allowed in 
  the rpmlintrc as this archive file is consumed by libonnxifi_loader.so
- Added the proto files from onnxruntime so that both packages can 
  use the same shared libraries:
  * added using-onnxruntime-proto.patch

OBS-URL: https://build.opensuse.org/request/show/821861
OBS-URL: https://build.opensuse.org/package/show/science:machinelearning/python-onnx?expand=0&rev=25
This commit is contained in:
Tomáš Chvátal
2020-08-17 06:37:58 +00:00
committed by Git OBS Bridge
parent 2ef859e36f
commit 1b0750c0cc
4 changed files with 616 additions and 3 deletions

View File

@@ -2,3 +2,5 @@
from Config import *
# there are source files which are parsed with pybind11, so they have to be included
addFilter("python3-onnx.* devel-file-in-non-devel-package")
# special library loader
addFilter("libonnxifi_dummy.* lto-no-text-in-archive")

View File

@@ -1,3 +1,20 @@
-------------------------------------------------------------------
Tue Jul 14 14:05:18 UTC 2020 - Christian Goll <cgoll@suse.com>
- reorganized package in order to have shared library support.
Additional packages are:
* onnx-devel
* libonnxifi_dummy
* libonnx
* onnx-devel
As no so versions for the shared libraries are available, there
is not a explicit dependency for the shared libraries.
The archive file libonnxifi_loader.a is explicitely allowed in
the rpmlintrc as this archive file is consumed by libonnxifi_loader.so
- Added the proto files from onnxruntime so that both packages can
use the same shared libraries:
* added using-onnxruntime-proto.patch
-------------------------------------------------------------------
Tue Jul 7 09:02:56 UTC 2020 - Christian Goll <cgoll@suse.com>

View File

@@ -27,6 +27,7 @@ URL: https://onnx.ai/
Source0: https://github.com/onnx/onnx/archive/v%{version}.tar.gz#/onnx-%{version}.tar.gz
Source1: %{name}-rpmlintrc
Patch1: no-python2.patch
Patch2: using-onnxruntime-proto.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module numpy}
BuildRequires: %{python_module protobuf}
@@ -41,6 +42,9 @@ BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: protobuf-devel
BuildRequires: python-rpm-macros
Requires: libonnx == %version
Requires: libonnx_proto == %version
Requires: libonnxifi_dummy == %version
Requires: python-numpy
Requires: python-protobuf
Requires: python-six
@@ -57,6 +61,43 @@ more easily move models between state-of-the-art tools and choose the
combination that is best for them. ONNX is developed and supported by a
community of partners.
%package -n onnx-devel
Summary: Header files of onnx
Requires: libonnx == %version
Requires: libonnx_proto == %version
Requires: libonnxifi_dummy == %version
%description -n onnx-devel
Header files of ONNX.
%package -n libonnxifi_dummy
Summary: Library for ONNX Interface for Framework Integration
%description -n libonnxifi_dummy
This package exists to create libonnx_proto, so you do no want
to install this package.
%package -n libonnx
Summary: Shared library for onnx
%description -n libonnx
This package exists to create libonnx_proto, so you do no want
to install this package.
%package -n libonnx_proto
Summary: Shared library for onnx protocul bufer
%description -n libonnx_proto
Shared library for the protocol buffer library, packaged separately to be
used by external project.
%package -n onnx-backend-test
Summary: Test data
%description -n onnx-backend-test
This packages includes the data for testing the backend.
%prep
%setup -q -n onnx-%{version}
# avoid bundles
@@ -80,16 +121,18 @@ sed -i -e '/pytest-runner/d' setup.py
-DONNX_USE_PROTOBUF_SHARED_LIBS=ON \
-DONNX_WERROR=OFF \
-DBUILD_ONNX_PYTHON=ON \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_STATIC_LIBS=ON \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_STATIC_LIBS=OFF \
-DPYTHON_EXECUTABLE="%{_bindir}/$python" \
-DPY_EXT_SUFFIX="`$python-config --extension-suffix`"
-DPY_EXT_SUFFIX="`$python-config --extension-suffix`" \
%{nil}
%cmake_build ; cd ..
}
%python_build
%install
%python_install
%cmake_install
%python_clone -a %{buildroot}%{_bindir}/backend-test-tools
%python_clone -a %{buildroot}%{_bindir}/check-node
%python_clone -a %{buildroot}%{_bindir}/check-model
@@ -125,4 +168,22 @@ cp %{__builddir}/*cpp2py* ./onnx/
%python_alternative %{_bindir}/backend-test-tools
%{python_sitearch}/onnx*
%files -n onnx-devel
%{_includedir}/onnx
%{_libdir}/cmake/*
%exclude %{_includedir}/onnx/backend
%files -n onnx-backend-test
%{_includedir}/onnx/backend
%files -n libonnxifi_dummy
%{_libdir}/libonnxifi*.so
%{_libdir}/libonnxifi_loader.*
/usr/lib/libonnxifi.so
%files -n libonnx
%{_libdir}/libonnx.so
%files -n libonnx_proto
%{_libdir}/libonnx_proto.so
%changelog

View File

@@ -0,0 +1,533 @@
From c44269ae65d9585740ee7a3ea897401ddb7e2d51 Mon Sep 17 00:00:00 2001
From: Christian Goll <cgoll@suse.de>
Date: Tue, 14 Jul 2020 12:01:55 +0200
Subject: [PATCH] using onnxruntime proto
---
onnx/onnx-ml.proto | 63 ++++++++++++++++++++++++++++-----
onnx/onnx-ml.proto3 | 54 ++++++++++++++++++++++++++--
onnx/onnx-operators-ml.proto | 55 -----------------------------
onnx/onnx-operators-ml.proto3 | 53 ----------------------------
onnx/onnx-operators.in.proto | 51 ---------------------------
onnx/onnx.in.proto | 66 ++++++++++++++++++++++++++++++-----
6 files changed, 164 insertions(+), 178 deletions(-)
diff --git a/onnx/onnx-ml.proto b/onnx/onnx-ml.proto
index d946d92f..e3ce6063 100644
--- a/onnx/onnx-ml.proto
+++ b/onnx/onnx-ml.proto
@@ -62,7 +62,7 @@ enum Version {
_START_VERSION = 0;
// The version field is always serialized and we will use it to store the
// version that the graph is generated from. This helps us set up version
- // control.
+ // control.
// For the IR, we are using simple numbers starting with 0x00000001,
// which was the version we published on Oct 10, 2017.
IR_VERSION_2017_10_10 = 0x0000000000000001;
@@ -259,7 +259,7 @@ message TrainingInfoProto {
optional GraphProto algorithm = 2;
// This field specifies the bindings from the outputs of "initialization" to
- // some initializers in "ModelProto.graph.initializer" and
+ // some initializers in "ModelProto.graph.initializer" and
// the "algorithm.initializer" in the same TrainingInfoProto.
// See "update_binding" below for details.
//
@@ -298,7 +298,7 @@ message TrainingInfoProto {
// 3. The values must be output names of "algorithm".
// 4. If an optional input of a graph is omitted when using GraphCall, the
// global variable with the same name may be used.
- // 5. When using GraphCall, the users always can pass values to optional
+ // 5. When using GraphCall, the users always can pass values to optional
// inputs of the called graph even if the associated initializers appears
// as keys in "update_binding"s.
// 6. The graphs in TrainingInfoProto's can use global variables as
@@ -365,6 +365,9 @@ message ModelProto {
// The parameterized graph that is evaluated to execute the model.
optional GraphProto graph = 7;
+ // kezhan: This field is not in ONNX, and will be pushed into ONNX with good use cases in microsoft.
+ repeated FunctionProto functions = 100;
+
// Named metadata values; keys should be distinct.
repeated StringStringEntryProto metadata_props = 14;
@@ -396,8 +399,6 @@ message TensorAnnotation {
repeated StringStringEntryProto quant_parameter_tensor_names = 2;
}
-
-
// Graphs
//
// A graph defines the computational logic of a model and is comprised of a parameterized
@@ -698,7 +699,6 @@ message TypeProto {
SparseTensor sparse_tensor_type = 8;
Opaque opaque_type = 7;
-
}
// An optional denotation can be used to denote the whole
@@ -723,7 +723,52 @@ message OperatorSetIdProto {
optional int64 version = 2;
}
+// Operator/function status.
+enum OperatorStatus {
+ EXPERIMENTAL = 0;
+ STABLE = 1;
+}
-// For using protobuf-lite
-option optimize_for = LITE_RUNTIME;
-
+message FunctionProto {
+ // The name of the function, similar usage of op_type in OperatorProto.
+ optional string name = 1;
+
+ // The first version of a function set which contains this function.
+ // When there's any breaking change for this function, the function set
+ // contains the function needs to bump its version, and since_version of
+ // the updated function will be changed to the updated function set version.
+ optional int64 since_version = 2;
+
+ // This field indicates whether the syntax, semantics, or presence
+ // of this function is in an experimental or stable stage. Once an
+ // function is published as STABLE, its syntax and semantics MUST NOT
+ // change in subsequent versions of the operator set.
+ // When a function is published as EXPERIMENTAL, the syntax and semantics
+ // of the function MAY change across operator set versions.
+ // Functions "become" stable by deprecating the experimental version and
+ // introducing a new stable function with the same name.
+ optional OperatorStatus status = 3;
+
+ // The inputs and outputs of the function.
+ repeated string input = 4;
+ repeated string output = 5;
+
+ // The attributes of the function.
+ repeated string attribute= 6;
+
+ // The nodes in the function.
+ repeated NodeProto node = 7;
+ // A human-readable documentation for this function. Markdown is allowed.
+ optional string doc_string = 8;
+
+ // The OperatorSets this function body (graph) relies on.
+ // A FunctionProto body (graph) may implicitly rely on the OperatorSet that
+ // this function belongs to. It can also explicitly rely on more OperatorSets
+ // with this field specified.
+ //
+ // All nodes in the function body (graph) will bind against the operator
+ // with the same-domain/same-op_type operator with the HIGHEST version
+ // in the referenced operator sets. This means at most one version can be relied
+ // for one domain.
+ repeated OperatorSetIdProto opset_import = 9;
+}
diff --git a/onnx/onnx-ml.proto3 b/onnx/onnx-ml.proto3
index f92b868a..76239ec1 100644
--- a/onnx/onnx-ml.proto3
+++ b/onnx/onnx-ml.proto3
@@ -365,6 +365,9 @@ message ModelProto {
// The parameterized graph that is evaluated to execute the model.
GraphProto graph = 7;
+ // kezhan: This field is not in ONNX, and will be pushed into ONNX with good use cases in microsoft.
+ repeated FunctionProto functions = 100;
+
// Named metadata values; keys should be distinct.
repeated StringStringEntryProto metadata_props = 14;
@@ -724,6 +727,53 @@ message OperatorSetIdProto {
}
-// For using protobuf-lite
-option optimize_for = LITE_RUNTIME;
+// Operator/function status.
+enum OperatorStatus {
+ EXPERIMENTAL = 0;
+ STABLE = 1;
+}
+
+message FunctionProto {
+ // The name of the function, similar usage of op_type in OperatorProto.
+ string name = 1;
+
+ // The first version of a function set which contains this function.
+ // When there's any breaking change for this function, the function set
+ // contains the function needs to bump its version, and since_version of
+ // the updated function will be changed to the updated function set version.
+ int64 since_version = 2;
+
+ // This field indicates whether the syntax, semantics, or presence
+ // of this function is in an experimental or stable stage. Once an
+ // function is published as STABLE, its syntax and semantics MUST NOT
+ // change in subsequent versions of the operator set.
+ // When a function is published as EXPERIMENTAL, the syntax and semantics
+ // of the function MAY change across operator set versions.
+ // Functions "become" stable by deprecating the experimental version and
+ // introducing a new stable function with the same name.
+ OperatorStatus status = 3;
+
+ // The inputs and outputs of the function.
+ repeated string input = 4;
+ repeated string output = 5;
+
+ // The attributes of the function.
+ repeated string attribute= 6;
+
+ // The nodes in the function.
+ repeated NodeProto node = 7;
+ // A human-readable documentation for this function. Markdown is allowed.
+ string doc_string = 8;
+
+ // The OperatorSets this function body (graph) relies on.
+ // A FunctionProto body (graph) may implicitly rely on the OperatorSet that
+ // this function belongs to. It can also explicitly rely on more OperatorSets
+ // with this field specified.
+ //
+ // All nodes in the function body (graph) will bind against the operator
+ // with the same-domain/same-op_type operator with the HIGHEST version
+ // in the referenced operator sets. This means at most one version can be relied
+ // for one domain.
+ repeated OperatorSetIdProto opset_import = 9;
+}
diff --git a/onnx/onnx-operators-ml.proto b/onnx/onnx-operators-ml.proto
index 6ad6a254..088c4f84 100644
--- a/onnx/onnx-operators-ml.proto
+++ b/onnx/onnx-operators-ml.proto
@@ -27,56 +27,6 @@ import "onnx/onnx-ml.proto";
// that describes the ONNX standard operators.
//
-// Operator/function status.
-enum OperatorStatus {
- EXPERIMENTAL = 0;
- STABLE = 1;
-}
-
-message FunctionProto {
- // The name of the function, similar usage of op_type in OperatorProto.
- optional string name = 1;
-
- // The first version of a function set which contains this function.
- // When there's any breaking change for this function, the function set
- // contains the function needs to bump its version, and since_version of
- // the updated function will be changed to the updated function set version.
- optional int64 since_version = 2;
-
- // This field indicates whether the syntax, semantics, or presence
- // of this function is in an experimental or stable stage. Once an
- // function is published as STABLE, its syntax and semantics MUST NOT
- // change in subsequent versions of the operator set.
- // When a function is published as EXPERIMENTAL, the syntax and semantics
- // of the function MAY change across operator set versions.
- // Functions "become" stable by deprecating the experimental version and
- // introducing a new stable function with the same name.
- optional OperatorStatus status = 3;
-
- // The inputs and outputs of the function.
- repeated string input = 4;
- repeated string output = 5;
-
- // The attributes of the function.
- repeated string attribute= 6;
-
- // The nodes in the function.
- repeated NodeProto node = 7;
- // A human-readable documentation for this function. Markdown is allowed.
- optional string doc_string = 8;
-
- // The OperatorSets this function body (graph) relies on.
- // A FunctionProto body (graph) may implicitly rely on the OperatorSet that
- // this function belongs to. It can also explicitly rely on more OperatorSets
- // with this field specified.
- //
- // All nodes in the function body (graph) will bind against the operator
- // with the same-domain/same-op_type operator with the HIGHEST version
- // in the referenced operator sets. This means at most one version can be relied
- // for one domain.
- repeated OperatorSetIdProto opset_import = 9;
-}
-
// An OperatorProto represents the immutable specification of the signature
// and semantics of an operator.
//
@@ -179,8 +129,3 @@ message OperatorSetProto {
// The (name, version) MUST be unique across all OperatorProtos/FunctionProtos in operator/functions
repeated FunctionProto functions = 9;
}
-
-
-// For using protobuf-lite
-option optimize_for = LITE_RUNTIME;
-
diff --git a/onnx/onnx-operators-ml.proto3 b/onnx/onnx-operators-ml.proto3
index f9a1e950..bff8de27 100644
--- a/onnx/onnx-operators-ml.proto3
+++ b/onnx/onnx-operators-ml.proto3
@@ -27,56 +27,6 @@ import "onnx/onnx-ml.proto3";
// that describes the ONNX standard operators.
//
-// Operator/function status.
-enum OperatorStatus {
- EXPERIMENTAL = 0;
- STABLE = 1;
-}
-
-message FunctionProto {
- // The name of the function, similar usage of op_type in OperatorProto.
- string name = 1;
-
- // The first version of a function set which contains this function.
- // When there's any breaking change for this function, the function set
- // contains the function needs to bump its version, and since_version of
- // the updated function will be changed to the updated function set version.
- int64 since_version = 2;
-
- // This field indicates whether the syntax, semantics, or presence
- // of this function is in an experimental or stable stage. Once an
- // function is published as STABLE, its syntax and semantics MUST NOT
- // change in subsequent versions of the operator set.
- // When a function is published as EXPERIMENTAL, the syntax and semantics
- // of the function MAY change across operator set versions.
- // Functions "become" stable by deprecating the experimental version and
- // introducing a new stable function with the same name.
- OperatorStatus status = 3;
-
- // The inputs and outputs of the function.
- repeated string input = 4;
- repeated string output = 5;
-
- // The attributes of the function.
- repeated string attribute= 6;
-
- // The nodes in the function.
- repeated NodeProto node = 7;
- // A human-readable documentation for this function. Markdown is allowed.
- string doc_string = 8;
-
- // The OperatorSets this function body (graph) relies on.
- // A FunctionProto body (graph) may implicitly rely on the OperatorSet that
- // this function belongs to. It can also explicitly rely on more OperatorSets
- // with this field specified.
- //
- // All nodes in the function body (graph) will bind against the operator
- // with the same-domain/same-op_type operator with the HIGHEST version
- // in the referenced operator sets. This means at most one version can be relied
- // for one domain.
- repeated OperatorSetIdProto opset_import = 9;
-}
-
// An OperatorProto represents the immutable specification of the signature
// and semantics of an operator.
//
@@ -181,6 +131,3 @@ message OperatorSetProto {
}
-// For using protobuf-lite
-option optimize_for = LITE_RUNTIME;
-
diff --git a/onnx/onnx-operators.in.proto b/onnx/onnx-operators.in.proto
index 923fac92..25881229 100644
--- a/onnx/onnx-operators.in.proto
+++ b/onnx/onnx-operators.in.proto
@@ -26,56 +26,6 @@ import "onnx/onnx.proto";
// that describes the ONNX standard operators.
//
-// Operator/function status.
-enum OperatorStatus {
- EXPERIMENTAL = 0;
- STABLE = 1;
-}
-
-message FunctionProto {
- // The name of the function, similar usage of op_type in OperatorProto.
- optional string name = 1;
-
- // The first version of a function set which contains this function.
- // When there's any breaking change for this function, the function set
- // contains the function needs to bump its version, and since_version of
- // the updated function will be changed to the updated function set version.
- optional int64 since_version = 2;
-
- // This field indicates whether the syntax, semantics, or presence
- // of this function is in an experimental or stable stage. Once an
- // function is published as STABLE, its syntax and semantics MUST NOT
- // change in subsequent versions of the operator set.
- // When a function is published as EXPERIMENTAL, the syntax and semantics
- // of the function MAY change across operator set versions.
- // Functions "become" stable by deprecating the experimental version and
- // introducing a new stable function with the same name.
- optional OperatorStatus status = 3;
-
- // The inputs and outputs of the function.
- repeated string input = 4;
- repeated string output = 5;
-
- // The attributes of the function.
- repeated string attribute= 6;
-
- // The nodes in the function.
- repeated NodeProto node = 7;
- // A human-readable documentation for this function. Markdown is allowed.
- optional string doc_string = 8;
-
- // The OperatorSets this function body (graph) relies on.
- // A FunctionProto body (graph) may implicitly rely on the OperatorSet that
- // this function belongs to. It can also explicitly rely on more OperatorSets
- // with this field specified.
- //
- // All nodes in the function body (graph) will bind against the operator
- // with the same-domain/same-op_type operator with the HIGHEST version
- // in the referenced operator sets. This means at most one version can be relied
- // for one domain.
- repeated OperatorSetIdProto opset_import = 9;
-}
-
// An OperatorProto represents the immutable specification of the signature
// and semantics of an operator.
//
@@ -178,4 +128,3 @@ message OperatorSetProto {
// The (name, version) MUST be unique across all OperatorProtos/FunctionProtos in operator/functions
repeated FunctionProto functions = 9;
}
-
diff --git a/onnx/onnx.in.proto b/onnx/onnx.in.proto
index 8bef6018..c239bd1d 100644
--- a/onnx/onnx.in.proto
+++ b/onnx/onnx.in.proto
@@ -59,7 +59,7 @@ enum Version {
_START_VERSION = 0;
// The version field is always serialized and we will use it to store the
// version that the graph is generated from. This helps us set up version
- // control.
+ // control.
// For the IR, we are using simple numbers starting with 0x00000001,
// which was the version we published on Oct 10, 2017.
IR_VERSION_2017_10_10 = 0x0000000000000001;
@@ -256,7 +256,7 @@ message TrainingInfoProto {
optional GraphProto algorithm = 2;
// This field specifies the bindings from the outputs of "initialization" to
- // some initializers in "ModelProto.graph.initializer" and
+ // some initializers in "ModelProto.graph.initializer" and
// the "algorithm.initializer" in the same TrainingInfoProto.
// See "update_binding" below for details.
//
@@ -295,7 +295,7 @@ message TrainingInfoProto {
// 3. The values must be output names of "algorithm".
// 4. If an optional input of a graph is omitted when using GraphCall, the
// global variable with the same name may be used.
- // 5. When using GraphCall, the users always can pass values to optional
+ // 5. When using GraphCall, the users always can pass values to optional
// inputs of the called graph even if the associated initializers appears
// as keys in "update_binding"s.
// 6. The graphs in TrainingInfoProto's can use global variables as
@@ -362,6 +362,9 @@ message ModelProto {
// The parameterized graph that is evaluated to execute the model.
optional GraphProto graph = 7;
+ // kezhan: This field is not in ONNX, and will be pushed into ONNX with good use cases in microsoft.
+ repeated FunctionProto functions = 100;
+
// Named metadata values; keys should be distinct.
repeated StringStringEntryProto metadata_props = 14;
@@ -393,8 +396,6 @@ message TensorAnnotation {
repeated StringStringEntryProto quant_parameter_tensor_names = 2;
}
-
-
// Graphs
//
// A graph defines the computational logic of a model and is comprised of a parameterized
@@ -656,7 +657,7 @@ message TypeProto {
optional TypeProto value_type = 2;
};
-// #if ONNX-ML
+ // #if ONNX-ML
message SparseTensor {
// This field MUST NOT have the value of UNDEFINED
@@ -693,13 +694,13 @@ message TypeProto {
// The type of a map.
Map map_type = 5;
-// #if ONNX-ML
+ // #if ONNX-ML
SparseTensor sparse_tensor_type = 8;
Opaque opaque_type = 7;
-// #endif
+ // #endif
}
// An optional denotation can be used to denote the whole
@@ -724,3 +725,52 @@ message OperatorSetIdProto {
optional int64 version = 2;
}
+// Operator/function status.
+enum OperatorStatus {
+ EXPERIMENTAL = 0;
+ STABLE = 1;
+}
+
+message FunctionProto {
+ // The name of the function, similar usage of op_type in OperatorProto.
+ optional string name = 1;
+
+ // The first version of a function set which contains this function.
+ // When there's any breaking change for this function, the function set
+ // contains the function needs to bump its version, and since_version of
+ // the updated function will be changed to the updated function set version.
+ optional int64 since_version = 2;
+
+ // This field indicates whether the syntax, semantics, or presence
+ // of this function is in an experimental or stable stage. Once an
+ // function is published as STABLE, its syntax and semantics MUST NOT
+ // change in subsequent versions of the operator set.
+ // When a function is published as EXPERIMENTAL, the syntax and semantics
+ // of the function MAY change across operator set versions.
+ // Functions "become" stable by deprecating the experimental version and
+ // introducing a new stable function with the same name.
+ optional OperatorStatus status = 3;
+
+ // The inputs and outputs of the function.
+ repeated string input = 4;
+ repeated string output = 5;
+
+ // The attributes of the function.
+ repeated string attribute= 6;
+
+ // The nodes in the function.
+ repeated NodeProto node = 7;
+ // A human-readable documentation for this function. Markdown is allowed.
+ optional string doc_string = 8;
+
+ // The OperatorSets this function body (graph) relies on.
+ // A FunctionProto body (graph) may implicitly rely on the OperatorSet that
+ // this function belongs to. It can also explicitly rely on more OperatorSets
+ // with this field specified.
+ //
+ // All nodes in the function body (graph) will bind against the operator
+ // with the same-domain/same-op_type operator with the HIGHEST version
+ // in the referenced operator sets. This means at most one version can be relied
+ // for one domain.
+ repeated OperatorSetIdProto opset_import = 9;
+}
--
2.26.2