onnxruntime 0.7.7-aarch64-linux → 0.8.0-aarch64-linux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce23d4b6be9a683e50c334391447d9a26dc4d558ff3c9f77ea9ea8c0107b694d
4
- data.tar.gz: eb1cda57a4bebc710424766403aefab3794cedbffe452e6888fb191414495d2c
3
+ metadata.gz: 42581a34c7c32a47193c8a17c5c585622157324b4bb50896300109b0e87dd385
4
+ data.tar.gz: 1c516ef64da2c7dc34d0069a74a3a7cb647e232e65a6839249bb40f238f25f01
5
5
  SHA512:
6
- metadata.gz: e65e14e82b60c41ada0370e97c7ee2c1bc9d6d83acbc53c3eb2604c4c8d22b274e4c8607fd68520b78389470acb6ebe494490b48b120a91fe1cacf7a9d5c5656
7
- data.tar.gz: 0bfe61bd70c84263cfa9e1864f60d78b105ea61cd02afc7be3d7febfb9d1a32868b998e50401d6847c9172cf66bc0457ba83b4bccfa19aca6ea6da186ef3cffd
6
+ metadata.gz: f8e8cf472b0f7b4c8583266a890c7b1032dbb7f6a6c3524d66e57cdb9e4a445b7a8c99852bec4f90b53375f1efbbc8a589b2f00b06eebbcdc849989133b8e12f
7
+ data.tar.gz: 59a2f7251e1be6ba2a534ce9025d66eb68495ded115b332e2983b45bf8bf9fa36e2df3a7b9ee4feefe03178894395e24aeb92188c919d770a72af7ffa91013de
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 0.8.0 (2023-09-20)
2
+
3
+ - Updated ONNX Runtime to 1.16.0
4
+ - Changed inputs and outputs to return symbolic dimension names
5
+ - Fixed GPU support
6
+ - Dropped support for Ruby < 3
7
+ - Dropped support for loading models from binary string (use `StringIO` instead)
8
+
1
9
  ## 0.7.7 (2023-07-24)
2
10
 
3
11
  - Updated ONNX Runtime to 1.15.1
data/README.md CHANGED
@@ -114,6 +114,12 @@ To enable GPU support on Linux and Windows, download the appropriate [GPU releas
114
114
  OnnxRuntime.ffi_lib = "path/to/lib/libonnxruntime.so" # onnxruntime.dll for Windows
115
115
  ```
116
116
 
117
+ and use:
118
+
119
+ ```ruby
120
+ model = OnnxRuntime::Model.new("model.onnx", providers: ["CUDAExecutionProvider"])
121
+ ```
122
+
117
123
  ## History
118
124
 
119
125
  View the [changelog](https://github.com/ankane/onnxruntime-ruby/blob/master/CHANGELOG.md)
@@ -7,7 +7,7 @@ module OnnxRuntime
7
7
  # https://github.com/microsoft/onnxruntime/blob/master/include/onnxruntime/core/session/onnxruntime_c_api.h
8
8
  # keep same order
9
9
 
10
- ORT_API_VERSION = 11
10
+ ORT_API_VERSION = 16
11
11
 
12
12
  # enums
13
13
  TensorElementDataType = enum(:undefined, :float, :uint8, :int8, :uint16, :int16, :int32, :int64, :string, :bool, :float16, :double, :uint32, :uint64, :complex64, :complex128, :bfloat16)
@@ -199,6 +199,7 @@ module OnnxRuntime
199
199
  :FillSparseTensorCsr, callback(%i[], :pointer),
200
200
  :FillSparseTensorBlockSparse, callback(%i[], :pointer),
201
201
  :CreateSparseTensorWithValuesAsOrtValue, callback(%i[], :pointer),
202
+ :UseCooIndices, callback(%i[], :pointer),
202
203
  :UseCsrIndices, callback(%i[], :pointer),
203
204
  :UseBlockSparseIndices, callback(%i[], :pointer),
204
205
  :GetSparseTensorFormat, callback(%i[], :pointer),
@@ -218,11 +219,11 @@ module OnnxRuntime
218
219
  :SetGlobalCustomJoinThreadFn, callback(%i[], :pointer),
219
220
  :SynchronizeBoundInputs, callback(%i[], :pointer),
220
221
  :SynchronizeBoundOutputs, callback(%i[], :pointer),
221
- :SessionOptionsAppendExecutionProvider_CUDA_V2, callback(%i[], :pointer),
222
- :CreateCUDAProviderOptions, callback(%i[], :pointer),
223
- :UpdateCUDAProviderOptions, callback(%i[], :pointer),
224
- :GetCUDAProviderOptionsAsString, callback(%i[], :pointer),
225
- :ReleaseCUDAProviderOptions, callback(%i[], :pointer),
222
+ :SessionOptionsAppendExecutionProvider_CUDA_V2, callback(%i[pointer pointer], :pointer),
223
+ :CreateCUDAProviderOptions, callback(%i[pointer], :pointer),
224
+ :UpdateCUDAProviderOptions, callback(%i[pointer pointer pointer size_t], :pointer),
225
+ :GetCUDAProviderOptionsAsString, callback(%i[pointer pointer pointer], :pointer),
226
+ :ReleaseCUDAProviderOptions, callback(%i[pointer], :void),
226
227
  :SessionOptionsAppendExecutionProvider_MIGraphX, callback(%i[], :pointer)
227
228
  end
228
229
 
@@ -2,7 +2,7 @@ module OnnxRuntime
2
2
  class InferenceSession
3
3
  attr_reader :inputs, :outputs
4
4
 
5
- def initialize(path_or_bytes, enable_cpu_mem_arena: true, enable_mem_pattern: true, enable_profiling: false, execution_mode: nil, free_dimension_overrides_by_denotation: nil, free_dimension_overrides_by_name: nil, graph_optimization_level: nil, inter_op_num_threads: nil, intra_op_num_threads: nil, log_severity_level: nil, log_verbosity_level: nil, logid: nil, optimized_model_filepath: nil, profile_file_prefix: nil, session_config_entries: nil)
5
+ def initialize(path_or_bytes, enable_cpu_mem_arena: true, enable_mem_pattern: true, enable_profiling: false, execution_mode: nil, free_dimension_overrides_by_denotation: nil, free_dimension_overrides_by_name: nil, graph_optimization_level: nil, inter_op_num_threads: nil, intra_op_num_threads: nil, log_severity_level: nil, log_verbosity_level: nil, logid: nil, optimized_model_filepath: nil, profile_file_prefix: nil, session_config_entries: nil, providers: [])
6
6
  # session options
7
7
  session_options = ::FFI::MemoryPointer.new(:pointer)
8
8
  check_status api[:CreateSessionOptions].call(session_options)
@@ -54,6 +54,24 @@ module OnnxRuntime
54
54
  check_status api[:AddSessionConfigEntry].call(session_options.read_pointer, k.to_s, v.to_s)
55
55
  end
56
56
  end
57
+ providers.each do |provider|
58
+ unless self.providers.include?(provider)
59
+ warn "Provider not available: #{provider}"
60
+ next
61
+ end
62
+
63
+ case provider
64
+ when "CUDAExecutionProvider"
65
+ cuda_options = ::FFI::MemoryPointer.new(:pointer)
66
+ check_status api[:CreateCUDAProviderOptions].call(cuda_options)
67
+ check_status api[:SessionOptionsAppendExecutionProvider_CUDA_V2].call(session_options.read_pointer, cuda_options.read_pointer)
68
+ release :CUDAProviderOptions, cuda_options
69
+ when "CPUExecutionProvider"
70
+ break
71
+ else
72
+ raise ArgumentError, "Provider not supported: #{provider}"
73
+ end
74
+ end
57
75
 
58
76
  @session = load_session(path_or_bytes, session_options)
59
77
  ObjectSpace.define_finalizer(@session, self.class.finalize(read_pointer.to_i))
@@ -185,8 +203,7 @@ module OnnxRuntime
185
203
  true
186
204
  else
187
205
  path_or_bytes = path_or_bytes.to_str
188
- # TODO remove ability to load byte string directly in 0.8.0
189
- path_or_bytes.encoding == Encoding::BINARY
206
+ false
190
207
  end
191
208
 
192
209
  if from_memory
@@ -509,11 +526,10 @@ module OnnxRuntime
509
526
  check_status api[:GetDimensions].call(tensor_info.read_pointer, node_dims, num_dims)
510
527
  dims = node_dims.read_array_of_int64(num_dims)
511
528
 
512
- # TODO uncomment in 0.8.0
513
- # symbolic_dims = ::FFI::MemoryPointer.new(:pointer, num_dims)
514
- # check_status api[:GetSymbolicDimensions].call(tensor_info.read_pointer, symbolic_dims, num_dims)
515
- # named_dims = num_dims.times.map { |i| symbolic_dims[i].read_pointer.read_string }
516
- # dims = named_dims.zip(dims).map { |n, d| n.empty? ? d : n }
529
+ symbolic_dims = ::FFI::MemoryPointer.new(:pointer, num_dims)
530
+ check_status api[:GetSymbolicDimensions].call(tensor_info.read_pointer, symbolic_dims, num_dims)
531
+ named_dims = num_dims.times.map { |i| symbolic_dims[i].read_pointer.read_string }
532
+ dims = named_dims.zip(dims).map { |n, d| n.empty? ? d : n }
517
533
 
518
534
  [type.read_int, dims]
519
535
  end
@@ -1,3 +1,3 @@
1
1
  module OnnxRuntime
2
- VERSION = "0.7.7"
2
+ VERSION = "0.8.0"
3
3
  end
@@ -6021,4 +6021,246 @@ OR OTHER DEALINGS IN THE SOFTWARE.
6021
6021
 
6022
6022
  Except as contained in this notice, the name of a copyright holder shall not
6023
6023
  be used in advertising or otherwise to promote the sale, use or other dealings
6024
- in this Software without prior written authorization of the copyright holder.
6024
+ in this Software without prior written authorization of the copyright holder.
6025
+
6026
+ _____
6027
+
6028
+ Intel neural-compressor
6029
+
6030
+ https://github.com/intel/neural-compressor
6031
+
6032
+ Apache License
6033
+ Version 2.0, January 2004
6034
+ http://www.apache.org/licenses/
6035
+
6036
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6037
+
6038
+ 1. Definitions.
6039
+
6040
+ "License" shall mean the terms and conditions for use, reproduction,
6041
+ and distribution as defined by Sections 1 through 9 of this document.
6042
+
6043
+ "Licensor" shall mean the copyright owner or entity authorized by
6044
+ the copyright owner that is granting the License.
6045
+
6046
+ "Legal Entity" shall mean the union of the acting entity and all
6047
+ other entities that control, are controlled by, or are under common
6048
+ control with that entity. For the purposes of this definition,
6049
+ "control" means (i) the power, direct or indirect, to cause the
6050
+ direction or management of such entity, whether by contract or
6051
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
6052
+ outstanding shares, or (iii) beneficial ownership of such entity.
6053
+
6054
+ "You" (or "Your") shall mean an individual or Legal Entity
6055
+ exercising permissions granted by this License.
6056
+
6057
+ "Source" form shall mean the preferred form for making modifications,
6058
+ including but not limited to software source code, documentation
6059
+ source, and configuration files.
6060
+
6061
+ "Object" form shall mean any form resulting from mechanical
6062
+ transformation or translation of a Source form, including but
6063
+ not limited to compiled object code, generated documentation,
6064
+ and conversions to other media types.
6065
+
6066
+ "Work" shall mean the work of authorship, whether in Source or
6067
+ Object form, made available under the License, as indicated by a
6068
+ copyright notice that is included in or attached to the work
6069
+ (an example is provided in the Appendix below).
6070
+
6071
+ "Derivative Works" shall mean any work, whether in Source or Object
6072
+ form, that is based on (or derived from) the Work and for which the
6073
+ editorial revisions, annotations, elaborations, or other modifications
6074
+ represent, as a whole, an original work of authorship. For the purposes
6075
+ of this License, Derivative Works shall not include works that remain
6076
+ separable from, or merely link (or bind by name) to the interfaces of,
6077
+ the Work and Derivative Works thereof.
6078
+
6079
+ "Contribution" shall mean any work of authorship, including
6080
+ the original version of the Work and any modifications or additions
6081
+ to that Work or Derivative Works thereof, that is intentionally
6082
+ submitted to Licensor for inclusion in the Work by the copyright owner
6083
+ or by an individual or Legal Entity authorized to submit on behalf of
6084
+ the copyright owner. For the purposes of this definition, "submitted"
6085
+ means any form of electronic, verbal, or written communication sent
6086
+ to the Licensor or its representatives, including but not limited to
6087
+ communication on electronic mailing lists, source code control systems,
6088
+ and issue tracking systems that are managed by, or on behalf of, the
6089
+ Licensor for the purpose of discussing and improving the Work, but
6090
+ excluding communication that is conspicuously marked or otherwise
6091
+ designated in writing by the copyright owner as "Not a Contribution."
6092
+
6093
+ "Contributor" shall mean Licensor and any individual or Legal Entity
6094
+ on behalf of whom a Contribution has been received by Licensor and
6095
+ subsequently incorporated within the Work.
6096
+
6097
+ 2. Grant of Copyright License. Subject to the terms and conditions of
6098
+ this License, each Contributor hereby grants to You a perpetual,
6099
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
6100
+ copyright license to reproduce, prepare Derivative Works of,
6101
+ publicly display, publicly perform, sublicense, and distribute the
6102
+ Work and such Derivative Works in Source or Object form.
6103
+
6104
+ 3. Grant of Patent License. Subject to the terms and conditions of
6105
+ this License, each Contributor hereby grants to You a perpetual,
6106
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
6107
+ (except as stated in this section) patent license to make, have made,
6108
+ use, offer to sell, sell, import, and otherwise transfer the Work,
6109
+ where such license applies only to those patent claims licensable
6110
+ by such Contributor that are necessarily infringed by their
6111
+ Contribution(s) alone or by combination of their Contribution(s)
6112
+ with the Work to which such Contribution(s) was submitted. If You
6113
+ institute patent litigation against any entity (including a
6114
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
6115
+ or a Contribution incorporated within the Work constitutes direct
6116
+ or contributory patent infringement, then any patent licenses
6117
+ granted to You under this License for that Work shall terminate
6118
+ as of the date such litigation is filed.
6119
+
6120
+ 4. Redistribution. You may reproduce and distribute copies of the
6121
+ Work or Derivative Works thereof in any medium, with or without
6122
+ modifications, and in Source or Object form, provided that You
6123
+ meet the following conditions:
6124
+
6125
+ (a) You must give any other recipients of the Work or
6126
+ Derivative Works a copy of this License; and
6127
+
6128
+ (b) You must cause any modified files to carry prominent notices
6129
+ stating that You changed the files; and
6130
+
6131
+ (c) You must retain, in the Source form of any Derivative Works
6132
+ that You distribute, all copyright, patent, trademark, and
6133
+ attribution notices from the Source form of the Work,
6134
+ excluding those notices that do not pertain to any part of
6135
+ the Derivative Works; and
6136
+
6137
+ (d) If the Work includes a "NOTICE" text file as part of its
6138
+ distribution, then any Derivative Works that You distribute must
6139
+ include a readable copy of the attribution notices contained
6140
+ within such NOTICE file, excluding those notices that do not
6141
+ pertain to any part of the Derivative Works, in at least one
6142
+ of the following places: within a NOTICE text file distributed
6143
+ as part of the Derivative Works; within the Source form or
6144
+ documentation, if provided along with the Derivative Works; or,
6145
+ within a display generated by the Derivative Works, if and
6146
+ wherever such third-party notices normally appear. The contents
6147
+ of the NOTICE file are for informational purposes only and
6148
+ do not modify the License. You may add Your own attribution
6149
+ notices within Derivative Works that You distribute, alongside
6150
+ or as an addendum to the NOTICE text from the Work, provided
6151
+ that such additional attribution notices cannot be construed
6152
+ as modifying the License.
6153
+
6154
+ You may add Your own copyright statement to Your modifications and
6155
+ may provide additional or different license terms and conditions
6156
+ for use, reproduction, or distribution of Your modifications, or
6157
+ for any such Derivative Works as a whole, provided Your use,
6158
+ reproduction, and distribution of the Work otherwise complies with
6159
+ the conditions stated in this License.
6160
+
6161
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
6162
+ any Contribution intentionally submitted for inclusion in the Work
6163
+ by You to the Licensor shall be under the terms and conditions of
6164
+ this License, without any additional terms or conditions.
6165
+ Notwithstanding the above, nothing herein shall supersede or modify
6166
+ the terms of any separate license agreement you may have executed
6167
+ with Licensor regarding such Contributions.
6168
+
6169
+ 6. Trademarks. This License does not grant permission to use the trade
6170
+ names, trademarks, service marks, or product names of the Licensor,
6171
+ except as required for reasonable and customary use in describing the
6172
+ origin of the Work and reproducing the content of the NOTICE file.
6173
+
6174
+ 7. Disclaimer of Warranty. Unless required by applicable law or
6175
+ agreed to in writing, Licensor provides the Work (and each
6176
+ Contributor provides its Contributions) on an "AS IS" BASIS,
6177
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
6178
+ implied, including, without limitation, any warranties or conditions
6179
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
6180
+ PARTICULAR PURPOSE. You are solely responsible for determining the
6181
+ appropriateness of using or redistributing the Work and assume any
6182
+ risks associated with Your exercise of permissions under this License.
6183
+
6184
+ 8. Limitation of Liability. In no event and under no legal theory,
6185
+ whether in tort (including negligence), contract, or otherwise,
6186
+ unless required by applicable law (such as deliberate and grossly
6187
+ negligent acts) or agreed to in writing, shall any Contributor be
6188
+ liable to You for damages, including any direct, indirect, special,
6189
+ incidental, or consequential damages of any character arising as a
6190
+ result of this License or out of the use or inability to use the
6191
+ Work (including but not limited to damages for loss of goodwill,
6192
+ work stoppage, computer failure or malfunction, or any and all
6193
+ other commercial damages or losses), even if such Contributor
6194
+ has been advised of the possibility of such damages.
6195
+
6196
+ 9. Accepting Warranty or Additional Liability. While redistributing
6197
+ the Work or Derivative Works thereof, You may choose to offer,
6198
+ and charge a fee for, acceptance of support, warranty, indemnity,
6199
+ or other liability obligations and/or rights consistent with this
6200
+ License. However, in accepting such obligations, You may act only
6201
+ on Your own behalf and on Your sole responsibility, not on behalf
6202
+ of any other Contributor, and only if You agree to indemnify,
6203
+ defend, and hold each Contributor harmless for any liability
6204
+ incurred by, or claims asserted against, such Contributor by reason
6205
+ of your accepting any such warranty or additional liability.
6206
+
6207
+ END OF TERMS AND CONDITIONS
6208
+
6209
+ ============================================================================
6210
+
6211
+ Copyright 2016-2019 Intel Corporation
6212
+ Copyright 2018 YANDEX LLC
6213
+
6214
+ Licensed under the Apache License, Version 2.0 (the "License");
6215
+ you may not use this file except in compliance with the License.
6216
+ You may obtain a copy of the License at
6217
+
6218
+ http://www.apache.org/licenses/LICENSE-2.0
6219
+
6220
+ Unless required by applicable law or agreed to in writing, software
6221
+ distributed under the License is distributed on an "AS IS" BASIS,
6222
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6223
+ See the License for the specific language governing permissions and
6224
+ limitations under the License.
6225
+
6226
+ This distribution includes third party software ("third party programs").
6227
+ This third party software, even if included with the distribution of
6228
+ the Intel software, may be governed by separate license terms, including
6229
+ without limitation, third party license terms, other Intel software license
6230
+ terms, and open source software license terms. These separate license terms
6231
+ govern your use of the third party programs as set forth in the
6232
+ "THIRD-PARTY-PROGRAMS" file.
6233
+
6234
+ _____
6235
+
6236
+ FlashAttention, https://github.com/Dao-AILab/flash-attention
6237
+
6238
+ BSD 3-Clause License
6239
+
6240
+ Copyright (c) 2022, the respective contributors, as shown by the AUTHORS file.
6241
+ All rights reserved.
6242
+
6243
+ Redistribution and use in source and binary forms, with or without
6244
+ modification, are permitted provided that the following conditions are met:
6245
+
6246
+ * Redistributions of source code must retain the above copyright notice, this
6247
+ list of conditions and the following disclaimer.
6248
+
6249
+ * Redistributions in binary form must reproduce the above copyright notice,
6250
+ this list of conditions and the following disclaimer in the documentation
6251
+ and/or other materials provided with the distribution.
6252
+
6253
+ * Neither the name of the copyright holder nor the names of its
6254
+ contributors may be used to endorse or promote products derived from
6255
+ this software without specific prior written permission.
6256
+
6257
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
6258
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
6259
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
6260
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
6261
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
6262
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
6263
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
6264
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
6265
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
6266
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onnxruntime
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.7
4
+ version: 0.8.0
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-25 00:00:00.000000000 Z
11
+ date: 2023-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -55,7 +55,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
55
55
  requirements:
56
56
  - - ">="
57
57
  - !ruby/object:Gem::Version
58
- version: '2.7'
58
+ version: '3'
59
59
  required_rubygems_version: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - ">="