m2m模型翻译
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
2.5 KiB

6 months ago
  1. # -------------------------------------------------------------------------
  2. # Copyright (c) Microsoft Corporation. All rights reserved.
  3. # Licensed under the MIT License.
  4. # --------------------------------------------------------------------------
  5. """
  6. ONNX Runtime is a performance-focused scoring engine for Open Neural Network Exchange (ONNX) models.
  7. For more information on ONNX Runtime, please see `aka.ms/onnxruntime <https://aka.ms/onnxruntime/>`_
  8. or the `Github project <https://github.com/microsoft/onnxruntime/>`_.
  9. """
  10. __version__ = "1.14.1"
  11. __author__ = "Microsoft"
  12. # we need to do device version validation (for example to check Cuda version for an onnxruntime-training package).
  13. # in order to know whether the onnxruntime package is for training it needs
  14. # to do import onnxruntime.training.ortmodule first.
  15. # onnxruntime.capi._pybind_state is required before import onnxruntime.training.ortmodule.
  16. # however, import onnxruntime.capi._pybind_state will already raise an exception if a required Cuda version
  17. # is not found.
  18. # here we need to save the exception and continue with Cuda version validation in order to post
  19. # meaningful messages to the user.
  20. # the saved exception is raised after device version validation.
  21. try:
  22. from onnxruntime.capi._pybind_state import (
  23. ExecutionMode,
  24. ExecutionOrder,
  25. GraphOptimizationLevel,
  26. ModelMetadata,
  27. NodeArg,
  28. OrtAllocatorType,
  29. OrtArenaCfg,
  30. OrtMemoryInfo,
  31. OrtMemType,
  32. OrtSparseFormat,
  33. RunOptions,
  34. SessionIOBinding,
  35. SessionOptions,
  36. create_and_register_allocator,
  37. disable_telemetry_events,
  38. enable_telemetry_events,
  39. get_all_providers,
  40. get_available_providers,
  41. get_device,
  42. set_default_logger_severity,
  43. set_default_logger_verbosity,
  44. set_seed,
  45. )
  46. import_capi_exception = None
  47. except Exception as e:
  48. import_capi_exception = e
  49. from onnxruntime.capi import onnxruntime_validation
  50. if import_capi_exception:
  51. raise import_capi_exception
  52. from onnxruntime.capi.onnxruntime_inference_collection import (
  53. InferenceSession,
  54. IOBinding,
  55. OrtDevice,
  56. OrtValue,
  57. SparseTensor,
  58. )
  59. from onnxruntime.capi.training import * # noqa: F403
  60. # TODO: thiagofc: Temporary experimental namespace for new PyTorch front-end
  61. try:
  62. from . import experimental
  63. except ImportError:
  64. pass
  65. from onnxruntime.capi.onnxruntime_validation import cuda_version, package_name, version
  66. if version:
  67. __version__ = version
  68. onnxruntime_validation.check_distro_info()