onnxruntime-directml 1.24.1__cp314-cp314-win_amd64.whl
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.
- onnxruntime/LICENSE +21 -0
- onnxruntime/Privacy.md +21 -0
- onnxruntime/ThirdPartyNotices.txt +6121 -0
- onnxruntime/__init__.py +418 -0
- onnxruntime/backend/__init__.py +6 -0
- onnxruntime/backend/backend.py +175 -0
- onnxruntime/backend/backend_rep.py +52 -0
- onnxruntime/capi/DirectML.dll +0 -0
- onnxruntime/capi/__init__.py +4 -0
- onnxruntime/capi/_ld_preload.py +7 -0
- onnxruntime/capi/_pybind_state.py +33 -0
- onnxruntime/capi/build_and_package_info.py +2 -0
- onnxruntime/capi/convert_npz_to_onnx_adapter.py +48 -0
- onnxruntime/capi/onnxruntime.dll +0 -0
- onnxruntime/capi/onnxruntime_collect_build_info.py +47 -0
- onnxruntime/capi/onnxruntime_inference_collection.py +1440 -0
- onnxruntime/capi/onnxruntime_providers_shared.dll +0 -0
- onnxruntime/capi/onnxruntime_pybind11_state.pyd +0 -0
- onnxruntime/capi/onnxruntime_validation.py +154 -0
- onnxruntime/capi/version_info.py +2 -0
- onnxruntime/datasets/__init__.py +18 -0
- onnxruntime/datasets/logreg_iris.onnx +0 -0
- onnxruntime/datasets/mul_1.onnx +0 -0
- onnxruntime/datasets/sigmoid.onnx +13 -0
- onnxruntime/quantization/CalTableFlatBuffers/KeyValue.py +78 -0
- onnxruntime/quantization/CalTableFlatBuffers/TrtTable.py +90 -0
- onnxruntime/quantization/CalTableFlatBuffers/__init__.py +0 -0
- onnxruntime/quantization/__init__.py +19 -0
- onnxruntime/quantization/base_quantizer.py +529 -0
- onnxruntime/quantization/calibrate.py +1267 -0
- onnxruntime/quantization/execution_providers/qnn/__init__.py +2 -0
- onnxruntime/quantization/execution_providers/qnn/fusion_lpnorm.py +132 -0
- onnxruntime/quantization/execution_providers/qnn/fusion_spacetodepth.py +162 -0
- onnxruntime/quantization/execution_providers/qnn/mixed_precision_overrides_utils.py +413 -0
- onnxruntime/quantization/execution_providers/qnn/preprocess.py +353 -0
- onnxruntime/quantization/execution_providers/qnn/quant_config.py +389 -0
- onnxruntime/quantization/fusions/__init__.py +4 -0
- onnxruntime/quantization/fusions/fusion.py +311 -0
- onnxruntime/quantization/fusions/fusion_gelu.py +272 -0
- onnxruntime/quantization/fusions/fusion_layernorm.py +146 -0
- onnxruntime/quantization/fusions/replace_upsample_with_resize.py +96 -0
- onnxruntime/quantization/matmul_bnb4_quantizer.py +239 -0
- onnxruntime/quantization/matmul_nbits_quantizer.py +1638 -0
- onnxruntime/quantization/neural_compressor/__init__.py +1 -0
- onnxruntime/quantization/neural_compressor/onnx_model.py +1251 -0
- onnxruntime/quantization/neural_compressor/util.py +80 -0
- onnxruntime/quantization/neural_compressor/weight_only.py +932 -0
- onnxruntime/quantization/onnx_model.py +600 -0
- onnxruntime/quantization/onnx_quantizer.py +1163 -0
- onnxruntime/quantization/operators/__init__.py +2 -0
- onnxruntime/quantization/operators/activation.py +119 -0
- onnxruntime/quantization/operators/argmax.py +18 -0
- onnxruntime/quantization/operators/attention.py +73 -0
- onnxruntime/quantization/operators/base_operator.py +26 -0
- onnxruntime/quantization/operators/binary_op.py +72 -0
- onnxruntime/quantization/operators/concat.py +62 -0
- onnxruntime/quantization/operators/conv.py +260 -0
- onnxruntime/quantization/operators/direct_q8.py +78 -0
- onnxruntime/quantization/operators/embed_layernorm.py +121 -0
- onnxruntime/quantization/operators/gather.py +64 -0
- onnxruntime/quantization/operators/gavgpool.py +62 -0
- onnxruntime/quantization/operators/gemm.py +172 -0
- onnxruntime/quantization/operators/lstm.py +121 -0
- onnxruntime/quantization/operators/matmul.py +231 -0
- onnxruntime/quantization/operators/maxpool.py +34 -0
- onnxruntime/quantization/operators/norm.py +40 -0
- onnxruntime/quantization/operators/pad.py +172 -0
- onnxruntime/quantization/operators/pooling.py +67 -0
- onnxruntime/quantization/operators/qdq_base_operator.py +22 -0
- onnxruntime/quantization/operators/resize.py +34 -0
- onnxruntime/quantization/operators/softmax.py +74 -0
- onnxruntime/quantization/operators/split.py +63 -0
- onnxruntime/quantization/operators/where.py +87 -0
- onnxruntime/quantization/preprocess.py +141 -0
- onnxruntime/quantization/qdq_loss_debug.py +389 -0
- onnxruntime/quantization/qdq_quantizer.py +1477 -0
- onnxruntime/quantization/quant_utils.py +1051 -0
- onnxruntime/quantization/quantize.py +953 -0
- onnxruntime/quantization/registry.py +110 -0
- onnxruntime/quantization/shape_inference.py +204 -0
- onnxruntime/quantization/static_quantize_runner.py +256 -0
- onnxruntime/quantization/tensor_quant_overrides.py +520 -0
- onnxruntime/tools/__init__.py +10 -0
- onnxruntime/tools/check_onnx_model_mobile_usability.py +47 -0
- onnxruntime/tools/convert_onnx_models_to_ort.py +380 -0
- onnxruntime/tools/file_utils.py +47 -0
- onnxruntime/tools/logger.py +11 -0
- onnxruntime/tools/make_dynamic_shape_fixed.py +73 -0
- onnxruntime/tools/mobile_helpers/__init__.py +0 -0
- onnxruntime/tools/mobile_helpers/coreml_supported_mlprogram_ops.md +53 -0
- onnxruntime/tools/mobile_helpers/coreml_supported_neuralnetwork_ops.md +43 -0
- onnxruntime/tools/mobile_helpers/nnapi_supported_ops.md +58 -0
- onnxruntime/tools/mobile_helpers/usability_checker.py +738 -0
- onnxruntime/tools/offline_tuning.py +169 -0
- onnxruntime/tools/onnx_model_utils.py +416 -0
- onnxruntime/tools/onnx_randomizer.py +85 -0
- onnxruntime/tools/onnxruntime_test.py +164 -0
- onnxruntime/tools/optimize_onnx_model.py +56 -0
- onnxruntime/tools/ort_format_model/__init__.py +27 -0
- onnxruntime/tools/ort_format_model/operator_type_usage_processors.py +653 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/__init__.py +0 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/ArgType.py +7 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/ArgTypeAndIndex.py +67 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/Attribute.py +337 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/AttributeType.py +18 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/Checkpoint.py +125 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/DeprecatedKernelCreateInfos.py +120 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/DeprecatedNodeIndexAndKernelDefHash.py +68 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/DeprecatedSessionState.py +96 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/DeprecatedSubGraphSessionState.py +72 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/Dimension.py +71 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/DimensionValue.py +80 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/DimensionValueType.py +8 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/EdgeEnd.py +32 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/FloatProperty.py +67 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/Graph.py +320 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/InferenceSession.py +88 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/IntProperty.py +67 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/KernelTypeStrArgsEntry.py +91 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/KernelTypeStrResolver.py +78 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/MapType.py +71 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/Model.py +223 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/ModuleState.py +141 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/Node.py +317 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/NodeEdge.py +126 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/NodeType.py +7 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/NodesToOptimizeIndices.py +160 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/OpIdKernelTypeStrArgsEntry.py +91 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/OperatorSetId.py +67 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/OptimizerGroup.py +117 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/ParameterOptimizerState.py +91 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/PropertyBag.py +152 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/RuntimeOptimizationRecord.py +105 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/RuntimeOptimizationRecordContainerEntry.py +91 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/RuntimeOptimizations.py +79 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/SequenceType.py +58 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/Shape.py +78 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/SparseTensor.py +114 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/StringProperty.py +67 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/StringStringEntry.py +67 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/Tensor.py +203 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/TensorDataType.py +26 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/TensorTypeAndShape.py +71 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/TypeInfo.py +83 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/TypeInfoValue.py +9 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/ValueInfo.py +84 -0
- onnxruntime/tools/ort_format_model/ort_flatbuffers_py/fbs/__init__.py +6 -0
- onnxruntime/tools/ort_format_model/ort_model_processor.py +86 -0
- onnxruntime/tools/ort_format_model/types.py +85 -0
- onnxruntime/tools/ort_format_model/utils.py +61 -0
- onnxruntime/tools/pytorch_export_contrib_ops.py +129 -0
- onnxruntime/tools/pytorch_export_helpers.py +131 -0
- onnxruntime/tools/qdq_helpers/__init__.py +0 -0
- onnxruntime/tools/qdq_helpers/optimize_qdq_model.py +37 -0
- onnxruntime/tools/qnn/add_trans_cast.py +292 -0
- onnxruntime/tools/qnn/gen_qnn_ctx_onnx_model.py +364 -0
- onnxruntime/tools/qnn/preprocess.py +165 -0
- onnxruntime/tools/reduced_build_config_parser.py +203 -0
- onnxruntime/tools/remove_initializer_from_input.py +37 -0
- onnxruntime/tools/symbolic_shape_infer.py +3094 -0
- onnxruntime/tools/update_onnx_opset.py +31 -0
- onnxruntime/transformers/__init__.py +8 -0
- onnxruntime/transformers/affinity_helper.py +40 -0
- onnxruntime/transformers/benchmark.py +942 -0
- onnxruntime/transformers/benchmark_helper.py +643 -0
- onnxruntime/transformers/bert_perf_test.py +629 -0
- onnxruntime/transformers/bert_test_data.py +641 -0
- onnxruntime/transformers/compare_bert_results.py +256 -0
- onnxruntime/transformers/constants.py +47 -0
- onnxruntime/transformers/convert_generation.py +3605 -0
- onnxruntime/transformers/convert_tf_models_to_pytorch.py +205 -0
- onnxruntime/transformers/convert_to_packing_mode.py +385 -0
- onnxruntime/transformers/dynamo_onnx_helper.py +205 -0
- onnxruntime/transformers/float16.py +501 -0
- onnxruntime/transformers/fusion_attention.py +1189 -0
- onnxruntime/transformers/fusion_attention_clip.py +340 -0
- onnxruntime/transformers/fusion_attention_sam2.py +533 -0
- onnxruntime/transformers/fusion_attention_unet.py +1307 -0
- onnxruntime/transformers/fusion_attention_vae.py +300 -0
- onnxruntime/transformers/fusion_bart_attention.py +435 -0
- onnxruntime/transformers/fusion_base.py +141 -0
- onnxruntime/transformers/fusion_bias_add.py +57 -0
- onnxruntime/transformers/fusion_biasgelu.py +66 -0
- onnxruntime/transformers/fusion_biassplitgelu.py +110 -0
- onnxruntime/transformers/fusion_conformer_attention.py +222 -0
- onnxruntime/transformers/fusion_constant_fold.py +144 -0
- onnxruntime/transformers/fusion_embedlayer.py +810 -0
- onnxruntime/transformers/fusion_fastgelu.py +492 -0
- onnxruntime/transformers/fusion_gelu.py +258 -0
- onnxruntime/transformers/fusion_gelu_approximation.py +25 -0
- onnxruntime/transformers/fusion_gemmfastgelu.py +121 -0
- onnxruntime/transformers/fusion_gpt_attention.py +546 -0
- onnxruntime/transformers/fusion_gpt_attention_megatron.py +355 -0
- onnxruntime/transformers/fusion_gpt_attention_no_past.py +260 -0
- onnxruntime/transformers/fusion_group_norm.py +180 -0
- onnxruntime/transformers/fusion_layernorm.py +489 -0
- onnxruntime/transformers/fusion_mha_mmdit.py +667 -0
- onnxruntime/transformers/fusion_nhwc_conv.py +99 -0
- onnxruntime/transformers/fusion_options.py +340 -0
- onnxruntime/transformers/fusion_qordered_attention.py +420 -0
- onnxruntime/transformers/fusion_qordered_gelu.py +118 -0
- onnxruntime/transformers/fusion_qordered_layernorm.py +122 -0
- onnxruntime/transformers/fusion_qordered_matmul.py +216 -0
- onnxruntime/transformers/fusion_quickgelu.py +74 -0
- onnxruntime/transformers/fusion_reshape.py +173 -0
- onnxruntime/transformers/fusion_rotary_attention.py +1591 -0
- onnxruntime/transformers/fusion_shape.py +109 -0
- onnxruntime/transformers/fusion_simplified_layernorm.py +165 -0
- onnxruntime/transformers/fusion_skip_group_norm.py +254 -0
- onnxruntime/transformers/fusion_skiplayernorm.py +209 -0
- onnxruntime/transformers/fusion_transpose.py +167 -0
- onnxruntime/transformers/fusion_utils.py +321 -0
- onnxruntime/transformers/huggingface_models.py +74 -0
- onnxruntime/transformers/import_utils.py +20 -0
- onnxruntime/transformers/io_binding_helper.py +487 -0
- onnxruntime/transformers/large_model_exporter.py +395 -0
- onnxruntime/transformers/machine_info.py +230 -0
- onnxruntime/transformers/metrics.py +163 -0
- onnxruntime/transformers/models/bart/__init__.py +12 -0
- onnxruntime/transformers/models/bart/export.py +98 -0
- onnxruntime/transformers/models/bert/__init__.py +12 -0
- onnxruntime/transformers/models/bert/eval_squad.py +329 -0
- onnxruntime/transformers/models/gpt2/__init__.py +12 -0
- onnxruntime/transformers/models/gpt2/benchmark_gpt2.py +413 -0
- onnxruntime/transformers/models/gpt2/convert_to_onnx.py +566 -0
- onnxruntime/transformers/models/gpt2/gpt2_helper.py +1031 -0
- onnxruntime/transformers/models/gpt2/gpt2_parity.py +513 -0
- onnxruntime/transformers/models/gpt2/gpt2_tester.py +501 -0
- onnxruntime/transformers/models/gpt2/parity_check_helper.py +146 -0
- onnxruntime/transformers/models/llama/__init__.py +12 -0
- onnxruntime/transformers/models/llama/benchmark.py +700 -0
- onnxruntime/transformers/models/llama/benchmark_all.py +488 -0
- onnxruntime/transformers/models/llama/benchmark_e2e.py +608 -0
- onnxruntime/transformers/models/llama/convert_to_onnx.py +1064 -0
- onnxruntime/transformers/models/llama/dist_settings.py +57 -0
- onnxruntime/transformers/models/llama/llama_inputs.py +504 -0
- onnxruntime/transformers/models/llama/llama_parity.py +343 -0
- onnxruntime/transformers/models/llama/llama_torch.py +47 -0
- onnxruntime/transformers/models/llama/quant_kv_dataloader.py +108 -0
- onnxruntime/transformers/models/longformer/__init__.py +12 -0
- onnxruntime/transformers/models/longformer/benchmark_longformer.py +821 -0
- onnxruntime/transformers/models/longformer/convert_to_onnx.py +413 -0
- onnxruntime/transformers/models/longformer/generate_test_data.py +347 -0
- onnxruntime/transformers/models/longformer/longformer_helper.py +76 -0
- onnxruntime/transformers/models/phi2/__init__.py +12 -0
- onnxruntime/transformers/models/phi2/convert_to_onnx.py +590 -0
- onnxruntime/transformers/models/phi2/inference_example.py +414 -0
- onnxruntime/transformers/models/sam2/__init__.py +12 -0
- onnxruntime/transformers/models/sam2/benchmark_sam2.py +638 -0
- onnxruntime/transformers/models/sam2/convert_to_onnx.py +270 -0
- onnxruntime/transformers/models/sam2/image_decoder.py +272 -0
- onnxruntime/transformers/models/sam2/image_encoder.py +236 -0
- onnxruntime/transformers/models/sam2/mask_decoder.py +208 -0
- onnxruntime/transformers/models/sam2/nvtx_helper.py +33 -0
- onnxruntime/transformers/models/sam2/prompt_encoder.py +189 -0
- onnxruntime/transformers/models/sam2/sam2_demo.py +321 -0
- onnxruntime/transformers/models/sam2/sam2_image_onnx_predictor.py +279 -0
- onnxruntime/transformers/models/sam2/sam2_utils.py +147 -0
- onnxruntime/transformers/models/stable_diffusion/__init__.py +12 -0
- onnxruntime/transformers/models/stable_diffusion/benchmark.py +1519 -0
- onnxruntime/transformers/models/stable_diffusion/benchmark_controlnet.py +426 -0
- onnxruntime/transformers/models/stable_diffusion/demo_txt2img.py +103 -0
- onnxruntime/transformers/models/stable_diffusion/demo_txt2img_xl.py +269 -0
- onnxruntime/transformers/models/stable_diffusion/demo_utils.py +778 -0
- onnxruntime/transformers/models/stable_diffusion/diffusion_models.py +1318 -0
- onnxruntime/transformers/models/stable_diffusion/diffusion_schedulers.py +1179 -0
- onnxruntime/transformers/models/stable_diffusion/engine_builder.py +295 -0
- onnxruntime/transformers/models/stable_diffusion/engine_builder_ort_cuda.py +387 -0
- onnxruntime/transformers/models/stable_diffusion/engine_builder_ort_trt.py +288 -0
- onnxruntime/transformers/models/stable_diffusion/engine_builder_tensorrt.py +395 -0
- onnxruntime/transformers/models/stable_diffusion/engine_builder_torch.py +108 -0
- onnxruntime/transformers/models/stable_diffusion/optimize_pipeline.py +590 -0
- onnxruntime/transformers/models/stable_diffusion/ort_optimizer.py +136 -0
- onnxruntime/transformers/models/stable_diffusion/pipeline_stable_diffusion.py +831 -0
- onnxruntime/transformers/models/stable_diffusion/trt_utilities.py +12 -0
- onnxruntime/transformers/models/t5/__init__.py +12 -0
- onnxruntime/transformers/models/t5/convert_to_onnx.py +318 -0
- onnxruntime/transformers/models/t5/t5_decoder.py +437 -0
- onnxruntime/transformers/models/t5/t5_encoder.py +70 -0
- onnxruntime/transformers/models/t5/t5_encoder_decoder_init.py +361 -0
- onnxruntime/transformers/models/t5/t5_helper.py +302 -0
- onnxruntime/transformers/models/whisper/__init__.py +12 -0
- onnxruntime/transformers/models/whisper/benchmark.py +585 -0
- onnxruntime/transformers/models/whisper/benchmark_all.py +526 -0
- onnxruntime/transformers/models/whisper/convert_to_onnx.py +609 -0
- onnxruntime/transformers/models/whisper/whisper_chain.py +334 -0
- onnxruntime/transformers/models/whisper/whisper_decoder.py +464 -0
- onnxruntime/transformers/models/whisper/whisper_encoder.py +164 -0
- onnxruntime/transformers/models/whisper/whisper_encoder_decoder_init.py +371 -0
- onnxruntime/transformers/models/whisper/whisper_helper.py +1035 -0
- onnxruntime/transformers/models/whisper/whisper_inputs.py +380 -0
- onnxruntime/transformers/models/whisper/whisper_jump_times.py +477 -0
- onnxruntime/transformers/onnx_exporter.py +719 -0
- onnxruntime/transformers/onnx_model.py +1636 -0
- onnxruntime/transformers/onnx_model_bart.py +141 -0
- onnxruntime/transformers/onnx_model_bert.py +488 -0
- onnxruntime/transformers/onnx_model_bert_keras.py +474 -0
- onnxruntime/transformers/onnx_model_bert_tf.py +588 -0
- onnxruntime/transformers/onnx_model_clip.py +42 -0
- onnxruntime/transformers/onnx_model_conformer.py +32 -0
- onnxruntime/transformers/onnx_model_gpt2.py +101 -0
- onnxruntime/transformers/onnx_model_mmdit.py +112 -0
- onnxruntime/transformers/onnx_model_phi.py +929 -0
- onnxruntime/transformers/onnx_model_sam2.py +137 -0
- onnxruntime/transformers/onnx_model_t5.py +985 -0
- onnxruntime/transformers/onnx_model_tnlr.py +226 -0
- onnxruntime/transformers/onnx_model_unet.py +258 -0
- onnxruntime/transformers/onnx_model_vae.py +42 -0
- onnxruntime/transformers/onnx_utils.py +55 -0
- onnxruntime/transformers/optimizer.py +620 -0
- onnxruntime/transformers/past_helper.py +149 -0
- onnxruntime/transformers/profile_result_processor.py +358 -0
- onnxruntime/transformers/profiler.py +434 -0
- onnxruntime/transformers/quantize_helper.py +76 -0
- onnxruntime/transformers/shape_infer_helper.py +121 -0
- onnxruntime/transformers/shape_optimizer.py +400 -0
- onnxruntime/transformers/torch_onnx_export_helper.py +74 -0
- onnxruntime_directml-1.24.1.dist-info/METADATA +216 -0
- onnxruntime_directml-1.24.1.dist-info/RECORD +322 -0
- onnxruntime_directml-1.24.1.dist-info/WHEEL +5 -0
- onnxruntime_directml-1.24.1.dist-info/entry_points.txt +2 -0
- onnxruntime_directml-1.24.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
# -------------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
# Licensed under the MIT License.
|
|
4
|
+
# --------------------------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
# This tool is not used directly in bert optimization. It could assist developing the optimization script on the following scenarios:
|
|
7
|
+
# (1) It could simplify graph by removing many sub-graphs related to reshape.
|
|
8
|
+
# (2) It could reduce extra inputs and outputs to fit other tools. The script compare_bert_results.py or bert_perf_test.py requires 3 inputs.
|
|
9
|
+
|
|
10
|
+
import argparse
|
|
11
|
+
import logging
|
|
12
|
+
import os
|
|
13
|
+
import re # noqa: F401
|
|
14
|
+
import sys
|
|
15
|
+
import tempfile
|
|
16
|
+
from collections import deque # noqa: F401
|
|
17
|
+
from datetime import datetime
|
|
18
|
+
from pathlib import Path # noqa: F401
|
|
19
|
+
|
|
20
|
+
import numpy as np
|
|
21
|
+
import onnx
|
|
22
|
+
from onnx import ModelProto, TensorProto, numpy_helper
|
|
23
|
+
from onnx_model import OnnxModel
|
|
24
|
+
|
|
25
|
+
import onnxruntime
|
|
26
|
+
|
|
27
|
+
logger = logging.getLogger(__name__)
|
|
28
|
+
|
|
29
|
+
CONSTANT_SHAPE_NAME_PREFIX = "constant_shape_opt__"
|
|
30
|
+
RESHAPE_INPUT_SHAPE_PREFIX = "reshape_input_shape__"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class BertOnnxModelShapeOptimizer(OnnxModel):
|
|
34
|
+
"""
|
|
35
|
+
This optimizer will replace Shape output or the shape input of Reshape node by initializer. Currently, it requires
|
|
36
|
+
model inputs to have static shape.
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
def __init__(self, onnx_model):
|
|
40
|
+
super().__init__(onnx_model.model)
|
|
41
|
+
|
|
42
|
+
def add_shape_initializer(self, shape):
|
|
43
|
+
"""
|
|
44
|
+
Add an initializer for constant shape.
|
|
45
|
+
"""
|
|
46
|
+
shape_value = np.asarray(shape, dtype=np.int64)
|
|
47
|
+
constant_shape_name = self.create_node_name("Constant", CONSTANT_SHAPE_NAME_PREFIX)
|
|
48
|
+
tensor = onnx.helper.make_tensor(
|
|
49
|
+
name=constant_shape_name,
|
|
50
|
+
data_type=TensorProto.INT64,
|
|
51
|
+
dims=shape_value.shape,
|
|
52
|
+
vals=shape_value,
|
|
53
|
+
)
|
|
54
|
+
self.add_initializer(tensor)
|
|
55
|
+
return tensor
|
|
56
|
+
|
|
57
|
+
def get_shape_outputs(self):
|
|
58
|
+
"""
|
|
59
|
+
Returns a list of output names of all Shape nodes.
|
|
60
|
+
"""
|
|
61
|
+
input_name_to_nodes = self.input_name_to_nodes()
|
|
62
|
+
|
|
63
|
+
outputs = []
|
|
64
|
+
for node in self.model.graph.node:
|
|
65
|
+
if node.op_type == "Shape":
|
|
66
|
+
if node.output[0] in input_name_to_nodes:
|
|
67
|
+
outputs.append(node.output[0])
|
|
68
|
+
|
|
69
|
+
return outputs
|
|
70
|
+
|
|
71
|
+
def get_reshape_shape_inputs(self):
|
|
72
|
+
"""
|
|
73
|
+
Returns a list of shape input names of Reshape nodes.
|
|
74
|
+
"""
|
|
75
|
+
self.output_name_to_node()
|
|
76
|
+
|
|
77
|
+
shape_inputs = []
|
|
78
|
+
for node in self.model.graph.node:
|
|
79
|
+
if node.op_type == "Reshape":
|
|
80
|
+
shape_inputs.append(node.input[1])
|
|
81
|
+
|
|
82
|
+
return shape_inputs
|
|
83
|
+
|
|
84
|
+
def add_shape_for_reshape_input(self):
|
|
85
|
+
"""
|
|
86
|
+
For each Reshape node, create a Shape node for its first input.
|
|
87
|
+
Returns the output names of these Shape nodes.
|
|
88
|
+
"""
|
|
89
|
+
output_names = []
|
|
90
|
+
nodes_to_add = []
|
|
91
|
+
for node in self.model.graph.node:
|
|
92
|
+
if node.op_type == "Reshape":
|
|
93
|
+
input = node.input[0]
|
|
94
|
+
output_name = self.create_node_name("Reshape_Input", RESHAPE_INPUT_SHAPE_PREFIX)
|
|
95
|
+
shape_node = onnx.helper.make_node("Shape", inputs=[input], outputs=[output_name])
|
|
96
|
+
nodes_to_add.append(shape_node)
|
|
97
|
+
output_names.append(output_name)
|
|
98
|
+
|
|
99
|
+
self.add_nodes(nodes_to_add)
|
|
100
|
+
return output_names
|
|
101
|
+
|
|
102
|
+
def add_extra_graph_output(self, extra_outputs):
|
|
103
|
+
"""
|
|
104
|
+
Add a list of output names to graph output.
|
|
105
|
+
"""
|
|
106
|
+
names_to_evaluate = []
|
|
107
|
+
output_names = [output.name for output in self.model.graph.output]
|
|
108
|
+
for name in extra_outputs:
|
|
109
|
+
if self.get_initializer(name) is not None: # already a constant
|
|
110
|
+
continue
|
|
111
|
+
names_to_evaluate.append(name)
|
|
112
|
+
|
|
113
|
+
if name not in output_names:
|
|
114
|
+
output_info = onnx.helper.ValueInfoProto()
|
|
115
|
+
output_info.name = name
|
|
116
|
+
self.model.graph.output.extend([output_info])
|
|
117
|
+
output_names.append(name)
|
|
118
|
+
|
|
119
|
+
return names_to_evaluate
|
|
120
|
+
|
|
121
|
+
# Update input and output shape to be static
|
|
122
|
+
def use_static_input(self, inputs, batch_size=1, max_seq_len=128):
|
|
123
|
+
"""
|
|
124
|
+
Update the model to use static axes instead of dynamic axes for graph inputs.
|
|
125
|
+
"""
|
|
126
|
+
for input in self.model.graph.input:
|
|
127
|
+
if input.name in inputs:
|
|
128
|
+
dim_proto = input.type.tensor_type.shape.dim[0]
|
|
129
|
+
dim_proto.dim_value = batch_size
|
|
130
|
+
dim_proto = input.type.tensor_type.shape.dim[1]
|
|
131
|
+
if dim_proto.HasField("dim_param"):
|
|
132
|
+
dim_proto.dim_value = max_seq_len
|
|
133
|
+
elif dim_proto.HasField("dim_value") and dim_proto.dim_value != max_seq_len:
|
|
134
|
+
raise ValueError(
|
|
135
|
+
f"Unable to set dimension value to {max_seq_len} for axis {1} of {input.name}. Contradicts existing dimension value {dim_proto.dim_value}."
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
def create_dummy_inputs(
|
|
139
|
+
self,
|
|
140
|
+
input_ids,
|
|
141
|
+
segment_ids,
|
|
142
|
+
input_mask,
|
|
143
|
+
batch_size,
|
|
144
|
+
sequence_length,
|
|
145
|
+
elem_type,
|
|
146
|
+
dictionary_size=8,
|
|
147
|
+
):
|
|
148
|
+
"""
|
|
149
|
+
Create dummy data for model inputs. If the model has more than 3 inputs, please update this function accordingly before running the tool.
|
|
150
|
+
"""
|
|
151
|
+
assert elem_type in [1, 6, 7] # only int32, int64 and float32 are supported.
|
|
152
|
+
|
|
153
|
+
# Create dummy inputs
|
|
154
|
+
input_1 = np.random.randint(dictionary_size, size=(batch_size, sequence_length), dtype=np.int32)
|
|
155
|
+
input_2 = np.ones((batch_size, sequence_length), dtype=np.int32)
|
|
156
|
+
input_3 = np.zeros((batch_size, sequence_length), dtype=np.int32)
|
|
157
|
+
|
|
158
|
+
# Here we assume that 3 inputs have same data type
|
|
159
|
+
if elem_type == 1: # float32
|
|
160
|
+
input_1 = np.float32(input_1)
|
|
161
|
+
input_2 = np.float32(input_2)
|
|
162
|
+
input_3 = np.float32(input_3)
|
|
163
|
+
elif elem_type == 7: # int64
|
|
164
|
+
input_1 = np.int64(input_1)
|
|
165
|
+
input_2 = np.int64(input_2)
|
|
166
|
+
input_3 = np.int64(input_3)
|
|
167
|
+
|
|
168
|
+
inputs = {input_ids: input_1, input_mask: input_2, segment_ids: input_3}
|
|
169
|
+
return inputs
|
|
170
|
+
|
|
171
|
+
def shape_optimization(
|
|
172
|
+
self,
|
|
173
|
+
temp_model_path,
|
|
174
|
+
input_ids,
|
|
175
|
+
segment_ids,
|
|
176
|
+
input_mask,
|
|
177
|
+
output_names,
|
|
178
|
+
batch_size,
|
|
179
|
+
sequence_length,
|
|
180
|
+
enable_shape_opt,
|
|
181
|
+
enable_reshape_opt,
|
|
182
|
+
verbose,
|
|
183
|
+
):
|
|
184
|
+
self.bert_inputs = [input_ids, segment_ids, input_mask]
|
|
185
|
+
|
|
186
|
+
extra_outputs = []
|
|
187
|
+
if enable_shape_opt:
|
|
188
|
+
extra_outputs.extend(self.get_shape_outputs())
|
|
189
|
+
|
|
190
|
+
if enable_reshape_opt:
|
|
191
|
+
reshape_shape_inputs = self.get_reshape_shape_inputs()
|
|
192
|
+
reshape_input_shapes = self.add_shape_for_reshape_input()
|
|
193
|
+
extra_outputs.extend(reshape_shape_inputs)
|
|
194
|
+
extra_outputs.extend(reshape_input_shapes)
|
|
195
|
+
|
|
196
|
+
if len(extra_outputs) == 0:
|
|
197
|
+
return
|
|
198
|
+
|
|
199
|
+
names_to_evaluate = self.add_extra_graph_output(extra_outputs)
|
|
200
|
+
|
|
201
|
+
# This tool does not support dynamic axes right now.
|
|
202
|
+
self.use_static_input(self.bert_inputs, batch_size, sequence_length)
|
|
203
|
+
|
|
204
|
+
with open(temp_model_path, "wb") as out:
|
|
205
|
+
out.write(self.model.SerializeToString())
|
|
206
|
+
sess_options = onnxruntime.SessionOptions()
|
|
207
|
+
sess_options.graph_optimization_level = onnxruntime.GraphOptimizationLevel.ORT_DISABLE_ALL
|
|
208
|
+
session = onnxruntime.InferenceSession(
|
|
209
|
+
temp_model_path,
|
|
210
|
+
sess_options,
|
|
211
|
+
providers=["CUDAExecutionProvider", "CPUExecutionProvider"],
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
elem_type = 7
|
|
215
|
+
for input in self.model.graph.input:
|
|
216
|
+
if input.name == input_ids:
|
|
217
|
+
elem_type = input.type.tensor_type.elem_type
|
|
218
|
+
inputs = self.create_dummy_inputs(input_ids, segment_ids, input_mask, batch_size, sequence_length, elem_type)
|
|
219
|
+
|
|
220
|
+
outputs = session.run(names_to_evaluate, inputs)
|
|
221
|
+
shapes = {}
|
|
222
|
+
for i, name in enumerate(names_to_evaluate):
|
|
223
|
+
shapes[name] = outputs[i]
|
|
224
|
+
|
|
225
|
+
logger.debug(f"shapes={shapes}")
|
|
226
|
+
|
|
227
|
+
if enable_reshape_opt:
|
|
228
|
+
for i, shape_input in enumerate(reshape_shape_inputs):
|
|
229
|
+
input_shape = reshape_input_shapes[i]
|
|
230
|
+
self.update_target_shape(shapes, shape_input, input_shape, verbose)
|
|
231
|
+
|
|
232
|
+
for name, shape in shapes.items():
|
|
233
|
+
tensor = self.add_shape_initializer(shape)
|
|
234
|
+
self.replace_input_of_all_nodes(name, tensor.name)
|
|
235
|
+
|
|
236
|
+
# Remove extra outputs, and prune all nodes not linked to output.
|
|
237
|
+
self.prune_graph(output_names)
|
|
238
|
+
|
|
239
|
+
def update_target_shape(self, shapes, shape_input, input_shape, verbose):
|
|
240
|
+
"""
|
|
241
|
+
Update the target shape to use 0 to represent that dimension value does not change.
|
|
242
|
+
For example, shape of source data is (2, 5, 8) and target shape is (2, 5, 4, 2), the target shape will be updated to (0, 0, 4, 2).
|
|
243
|
+
"""
|
|
244
|
+
if shape_input in shapes:
|
|
245
|
+
target_shape = shapes[shape_input]
|
|
246
|
+
else:
|
|
247
|
+
initializer = self.get_initializer(shape_input)
|
|
248
|
+
assert initializer is not None
|
|
249
|
+
target_shape = numpy_helper.to_array(initializer)
|
|
250
|
+
|
|
251
|
+
if input_shape in shapes:
|
|
252
|
+
source_shape = shapes[input_shape]
|
|
253
|
+
else:
|
|
254
|
+
initializer = self.get_initializer(input_shape)
|
|
255
|
+
assert initializer is not None
|
|
256
|
+
source_shape = numpy_helper.to_array(initializer)
|
|
257
|
+
|
|
258
|
+
new_target_shape = []
|
|
259
|
+
for i, dim_value in enumerate(target_shape):
|
|
260
|
+
if i < len(source_shape) and source_shape[i] == dim_value:
|
|
261
|
+
new_target_shape.append(0)
|
|
262
|
+
else:
|
|
263
|
+
new_target_shape.append(dim_value)
|
|
264
|
+
shapes[shape_input] = new_target_shape
|
|
265
|
+
|
|
266
|
+
logger.debug(f"source_shape={source_shape}, target_shape={target_shape}, new_target_shape={new_target_shape}")
|
|
267
|
+
|
|
268
|
+
def validate_input(self, input: str):
|
|
269
|
+
if not self.find_graph_input(input):
|
|
270
|
+
valid_names = [input.name for input in self.model.graph.input]
|
|
271
|
+
raise Exception(f"Input {input} does not exist in the graph inputs: {valid_names}")
|
|
272
|
+
|
|
273
|
+
def validate_outputs(self, output_names: list[str]):
|
|
274
|
+
valid_names = [output.name for output in self.model.graph.output]
|
|
275
|
+
for name in output_names:
|
|
276
|
+
if name not in valid_names:
|
|
277
|
+
raise Exception(f"Output {name} does not exist in the graph outputs: {valid_names}")
|
|
278
|
+
|
|
279
|
+
def optimize(
|
|
280
|
+
self,
|
|
281
|
+
output_path: str,
|
|
282
|
+
input_ids: str,
|
|
283
|
+
segment_ids: str,
|
|
284
|
+
input_mask: str,
|
|
285
|
+
enable_shape_opt: bool,
|
|
286
|
+
enable_reshape_opt: bool,
|
|
287
|
+
output_names: list[str] | None = None,
|
|
288
|
+
batch_size=1,
|
|
289
|
+
sequence_length=128,
|
|
290
|
+
verbose=False,
|
|
291
|
+
):
|
|
292
|
+
# Skip if shape optimization has been done before.
|
|
293
|
+
for tensor in self.model.graph.initializer:
|
|
294
|
+
if tensor.name.startswith(CONSTANT_SHAPE_NAME_PREFIX):
|
|
295
|
+
logger.info("Skip shape optimization since it has been done before")
|
|
296
|
+
return
|
|
297
|
+
|
|
298
|
+
self.validate_input(input_ids)
|
|
299
|
+
self.validate_input(segment_ids)
|
|
300
|
+
self.validate_input(input_mask)
|
|
301
|
+
|
|
302
|
+
if output_names is not None:
|
|
303
|
+
self.validate_outputs(output_names)
|
|
304
|
+
self.prune_graph(output_names)
|
|
305
|
+
|
|
306
|
+
remaining_outputs = [output.name for output in self.model.graph.output]
|
|
307
|
+
|
|
308
|
+
if enable_shape_opt or enable_reshape_opt:
|
|
309
|
+
if len(self.get_graph_inputs_excluding_initializers()) != 3:
|
|
310
|
+
logger.info("Skip shape optimization since graph input number is not 3")
|
|
311
|
+
return
|
|
312
|
+
|
|
313
|
+
with tempfile.TemporaryDirectory() as temp_dir:
|
|
314
|
+
temp_file_name = "temp_{}.onnx".format(datetime.now().strftime("%m_%d-%H_%M_%S"))
|
|
315
|
+
dir = "." if verbose else temp_dir
|
|
316
|
+
temp_file = os.path.join(dir, temp_file_name)
|
|
317
|
+
self.shape_optimization(
|
|
318
|
+
temp_file,
|
|
319
|
+
input_ids,
|
|
320
|
+
segment_ids,
|
|
321
|
+
input_mask,
|
|
322
|
+
remaining_outputs,
|
|
323
|
+
batch_size,
|
|
324
|
+
sequence_length,
|
|
325
|
+
enable_shape_opt,
|
|
326
|
+
enable_reshape_opt,
|
|
327
|
+
verbose,
|
|
328
|
+
)
|
|
329
|
+
logger.debug(f"Temp model with additional outputs: {temp_file}")
|
|
330
|
+
logger.warning(
|
|
331
|
+
f"Shape optimization is done. The optimized model might only work for input with batch_size={batch_size} sequence_length={sequence_length}"
|
|
332
|
+
)
|
|
333
|
+
|
|
334
|
+
if output_path is not None:
|
|
335
|
+
with open(output_path, "wb") as out:
|
|
336
|
+
out.write(self.model.SerializeToString())
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
def parse_arguments():
|
|
340
|
+
parser = argparse.ArgumentParser()
|
|
341
|
+
parser.add_argument("--input", required=True, type=str)
|
|
342
|
+
parser.add_argument("--output", required=True, type=str)
|
|
343
|
+
parser.add_argument("--input_ids", required=True, type=str)
|
|
344
|
+
parser.add_argument("--segment_ids", required=True, type=str)
|
|
345
|
+
parser.add_argument("--input_mask", required=True, type=str)
|
|
346
|
+
parser.add_argument("--output_names", required=False, type=str, default=None)
|
|
347
|
+
parser.add_argument("--batch_size", required=False, type=int, default=1)
|
|
348
|
+
parser.add_argument("--sequence_length", required=False, type=int, default=128)
|
|
349
|
+
parser.add_argument("--enable_shape_opt", required=False, action="store_true")
|
|
350
|
+
parser.set_defaults(enable_shape_opt=False)
|
|
351
|
+
parser.add_argument("--enable_reshape_opt", required=False, action="store_true")
|
|
352
|
+
parser.set_defaults(enable_reshape_opt=False)
|
|
353
|
+
parser.add_argument("--verbose", required=False, action="store_true")
|
|
354
|
+
parser.set_defaults(verbose=False)
|
|
355
|
+
args = parser.parse_args()
|
|
356
|
+
return args
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
def setup_logging(verbose):
|
|
360
|
+
log_handler = logging.StreamHandler(sys.stdout)
|
|
361
|
+
if verbose:
|
|
362
|
+
log_handler.setFormatter(logging.Formatter("[%(filename)s:%(lineno)s - %(funcName)20s()] %(message)s"))
|
|
363
|
+
logging_level = logging.DEBUG
|
|
364
|
+
else:
|
|
365
|
+
log_handler.setFormatter(logging.Formatter("%(filename)20s: %(message)s"))
|
|
366
|
+
logging_level = logging.INFO
|
|
367
|
+
log_handler.setLevel(logging_level)
|
|
368
|
+
logger.addHandler(log_handler)
|
|
369
|
+
logger.setLevel(logging_level)
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
def main():
|
|
373
|
+
args = parse_arguments()
|
|
374
|
+
setup_logging(args.verbose)
|
|
375
|
+
|
|
376
|
+
output_names = None if args.output_names is None else args.output_names.split(";")
|
|
377
|
+
|
|
378
|
+
model = ModelProto()
|
|
379
|
+
with open(args.input, "rb") as input_file:
|
|
380
|
+
model.ParseFromString(input_file.read())
|
|
381
|
+
onnx_model = OnnxModel(model)
|
|
382
|
+
|
|
383
|
+
optimizer = BertOnnxModelShapeOptimizer(onnx_model)
|
|
384
|
+
|
|
385
|
+
optimizer.optimize(
|
|
386
|
+
args.output,
|
|
387
|
+
args.input_ids,
|
|
388
|
+
args.segment_ids,
|
|
389
|
+
args.input_mask,
|
|
390
|
+
args.enable_shape_opt,
|
|
391
|
+
args.enable_reshape_opt,
|
|
392
|
+
output_names,
|
|
393
|
+
args.batch_size,
|
|
394
|
+
args.sequence_length,
|
|
395
|
+
args.verbose,
|
|
396
|
+
)
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
if __name__ == "__main__":
|
|
400
|
+
main()
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# -------------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
# Licensed under the MIT License.
|
|
4
|
+
# --------------------------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
import torch
|
|
7
|
+
from torch._C._onnx import OperatorExportTypes
|
|
8
|
+
|
|
9
|
+
TrainingMode = torch.onnx.TrainingMode
|
|
10
|
+
from packaging.version import Version # noqa: E402
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def torch_onnx_export(
|
|
14
|
+
model,
|
|
15
|
+
args,
|
|
16
|
+
f,
|
|
17
|
+
export_params=True,
|
|
18
|
+
verbose=False,
|
|
19
|
+
training=TrainingMode.EVAL,
|
|
20
|
+
input_names=None,
|
|
21
|
+
output_names=None,
|
|
22
|
+
operator_export_type=OperatorExportTypes.ONNX,
|
|
23
|
+
opset_version=None,
|
|
24
|
+
_retain_param_name=None,
|
|
25
|
+
do_constant_folding=True,
|
|
26
|
+
example_outputs=None,
|
|
27
|
+
strip_doc_string=None,
|
|
28
|
+
dynamic_axes=None,
|
|
29
|
+
keep_initializers_as_inputs=None,
|
|
30
|
+
custom_opsets=None,
|
|
31
|
+
enable_onnx_checker=None,
|
|
32
|
+
use_external_data_format=None,
|
|
33
|
+
export_modules_as_functions=False,
|
|
34
|
+
):
|
|
35
|
+
if Version(torch.__version__) >= Version("1.11.0"):
|
|
36
|
+
torch.onnx.export(
|
|
37
|
+
model=model,
|
|
38
|
+
args=args,
|
|
39
|
+
f=f,
|
|
40
|
+
export_params=export_params,
|
|
41
|
+
verbose=verbose,
|
|
42
|
+
training=training,
|
|
43
|
+
input_names=input_names,
|
|
44
|
+
output_names=output_names,
|
|
45
|
+
operator_export_type=operator_export_type,
|
|
46
|
+
opset_version=opset_version,
|
|
47
|
+
do_constant_folding=do_constant_folding,
|
|
48
|
+
dynamic_axes=dynamic_axes,
|
|
49
|
+
keep_initializers_as_inputs=keep_initializers_as_inputs,
|
|
50
|
+
custom_opsets=custom_opsets,
|
|
51
|
+
export_modules_as_functions=export_modules_as_functions,
|
|
52
|
+
)
|
|
53
|
+
else:
|
|
54
|
+
torch.onnx.export(
|
|
55
|
+
model=model,
|
|
56
|
+
args=args,
|
|
57
|
+
f=f,
|
|
58
|
+
export_params=export_params,
|
|
59
|
+
verbose=verbose,
|
|
60
|
+
training=training,
|
|
61
|
+
input_names=input_names,
|
|
62
|
+
output_names=output_names,
|
|
63
|
+
operator_export_type=operator_export_type,
|
|
64
|
+
opset_version=opset_version,
|
|
65
|
+
_retain_param_name=_retain_param_name,
|
|
66
|
+
do_constant_folding=do_constant_folding,
|
|
67
|
+
example_outputs=example_outputs,
|
|
68
|
+
strip_doc_string=strip_doc_string,
|
|
69
|
+
dynamic_axes=dynamic_axes,
|
|
70
|
+
keep_initializers_as_inputs=keep_initializers_as_inputs,
|
|
71
|
+
custom_opsets=custom_opsets,
|
|
72
|
+
enable_onnx_checker=enable_onnx_checker,
|
|
73
|
+
use_external_data_format=use_external_data_format,
|
|
74
|
+
)
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: onnxruntime-directml
|
|
3
|
+
Version: 1.24.1
|
|
4
|
+
Summary: ONNX Runtime is a runtime accelerator for Machine Learning models
|
|
5
|
+
Home-page: https://onnxruntime.ai
|
|
6
|
+
Download-URL: https://github.com/microsoft/onnxruntime/tags
|
|
7
|
+
Author: Microsoft Corporation
|
|
8
|
+
Author-email: onnxruntime@microsoft.com
|
|
9
|
+
License: MIT License
|
|
10
|
+
Keywords: onnx machine learning
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
15
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
16
|
+
Classifier: Operating System :: MacOS
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Classifier: Topic :: Software Development
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Classifier: Programming Language :: Python
|
|
24
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
28
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
29
|
+
Requires-Python: >=3.10
|
|
30
|
+
Requires-Dist: flatbuffers
|
|
31
|
+
Requires-Dist: numpy>=1.21.6
|
|
32
|
+
Requires-Dist: packaging
|
|
33
|
+
Requires-Dist: protobuf
|
|
34
|
+
Requires-Dist: sympy
|
|
35
|
+
Dynamic: author
|
|
36
|
+
Dynamic: author-email
|
|
37
|
+
Dynamic: classifier
|
|
38
|
+
Dynamic: description
|
|
39
|
+
Dynamic: download-url
|
|
40
|
+
Dynamic: home-page
|
|
41
|
+
Dynamic: keywords
|
|
42
|
+
Dynamic: license
|
|
43
|
+
Dynamic: requires-dist
|
|
44
|
+
Dynamic: requires-python
|
|
45
|
+
Dynamic: summary
|
|
46
|
+
|
|
47
|
+
ONNX Runtime
|
|
48
|
+
============
|
|
49
|
+
|
|
50
|
+
ONNX Runtime is a performance-focused scoring engine for Open Neural Network Exchange (ONNX) models.
|
|
51
|
+
For more information on ONNX Runtime, please see `aka.ms/onnxruntime <https://aka.ms/onnxruntime/>`_ or the `Github project <https://github.com/microsoft/onnxruntime/>`_.
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
Changes
|
|
55
|
+
-------
|
|
56
|
+
|
|
57
|
+
1.24.1
|
|
58
|
+
^^^^^^
|
|
59
|
+
|
|
60
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.24.1
|
|
61
|
+
|
|
62
|
+
1.23.0
|
|
63
|
+
^^^^^^
|
|
64
|
+
|
|
65
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.23.0
|
|
66
|
+
|
|
67
|
+
1.22.0
|
|
68
|
+
^^^^^^
|
|
69
|
+
|
|
70
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.22.0
|
|
71
|
+
|
|
72
|
+
1.21.0
|
|
73
|
+
^^^^^^
|
|
74
|
+
|
|
75
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.21.0
|
|
76
|
+
|
|
77
|
+
1.20.0
|
|
78
|
+
^^^^^^
|
|
79
|
+
|
|
80
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.20.0
|
|
81
|
+
|
|
82
|
+
1.19.0
|
|
83
|
+
^^^^^^
|
|
84
|
+
|
|
85
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.19.0
|
|
86
|
+
|
|
87
|
+
1.18.0
|
|
88
|
+
^^^^^^
|
|
89
|
+
|
|
90
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.18.0
|
|
91
|
+
|
|
92
|
+
1.17.0
|
|
93
|
+
^^^^^^
|
|
94
|
+
|
|
95
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.17.0
|
|
96
|
+
|
|
97
|
+
1.16.0
|
|
98
|
+
^^^^^^
|
|
99
|
+
|
|
100
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.16.0
|
|
101
|
+
|
|
102
|
+
1.15.0
|
|
103
|
+
^^^^^^
|
|
104
|
+
|
|
105
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.15.0
|
|
106
|
+
|
|
107
|
+
1.14.0
|
|
108
|
+
^^^^^^
|
|
109
|
+
|
|
110
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.14.0
|
|
111
|
+
|
|
112
|
+
1.13.0
|
|
113
|
+
^^^^^^
|
|
114
|
+
|
|
115
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.13.0
|
|
116
|
+
|
|
117
|
+
1.12.0
|
|
118
|
+
^^^^^^
|
|
119
|
+
|
|
120
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.12.0
|
|
121
|
+
|
|
122
|
+
1.11.0
|
|
123
|
+
^^^^^^
|
|
124
|
+
|
|
125
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.11.0
|
|
126
|
+
|
|
127
|
+
1.10.0
|
|
128
|
+
^^^^^^
|
|
129
|
+
|
|
130
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.10.0
|
|
131
|
+
|
|
132
|
+
1.9.0
|
|
133
|
+
^^^^^
|
|
134
|
+
|
|
135
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.9.0
|
|
136
|
+
|
|
137
|
+
1.8.2
|
|
138
|
+
^^^^^
|
|
139
|
+
|
|
140
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.8.2
|
|
141
|
+
|
|
142
|
+
1.8.1
|
|
143
|
+
^^^^^
|
|
144
|
+
|
|
145
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.8.1
|
|
146
|
+
|
|
147
|
+
1.8.0
|
|
148
|
+
^^^^^
|
|
149
|
+
|
|
150
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.8.0
|
|
151
|
+
|
|
152
|
+
1.7.0
|
|
153
|
+
^^^^^
|
|
154
|
+
|
|
155
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.7.0
|
|
156
|
+
|
|
157
|
+
1.6.0
|
|
158
|
+
^^^^^
|
|
159
|
+
|
|
160
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.6.0
|
|
161
|
+
|
|
162
|
+
1.5.3
|
|
163
|
+
^^^^^
|
|
164
|
+
|
|
165
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.5.3
|
|
166
|
+
|
|
167
|
+
1.5.2
|
|
168
|
+
^^^^^
|
|
169
|
+
|
|
170
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.5.2
|
|
171
|
+
|
|
172
|
+
1.5.1
|
|
173
|
+
^^^^^
|
|
174
|
+
|
|
175
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.5.1
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
1.4.0
|
|
179
|
+
^^^^^
|
|
180
|
+
|
|
181
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.4.0
|
|
182
|
+
|
|
183
|
+
1.3.1
|
|
184
|
+
^^^^^
|
|
185
|
+
|
|
186
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.3.1
|
|
187
|
+
|
|
188
|
+
1.3.0
|
|
189
|
+
^^^^^
|
|
190
|
+
|
|
191
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.3.0
|
|
192
|
+
|
|
193
|
+
1.2.0
|
|
194
|
+
^^^^^
|
|
195
|
+
|
|
196
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.2.0
|
|
197
|
+
|
|
198
|
+
1.1.0
|
|
199
|
+
^^^^^
|
|
200
|
+
|
|
201
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.1.0
|
|
202
|
+
|
|
203
|
+
1.0.0
|
|
204
|
+
^^^^^
|
|
205
|
+
|
|
206
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v1.0.0
|
|
207
|
+
|
|
208
|
+
0.5.0
|
|
209
|
+
^^^^^
|
|
210
|
+
|
|
211
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v0.5.0
|
|
212
|
+
|
|
213
|
+
0.4.0
|
|
214
|
+
^^^^^
|
|
215
|
+
|
|
216
|
+
Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v0.4.0
|