jam134 commited on
Commit
f20ef29
·
verified ·
1 Parent(s): 7e5b6e9

Upload runtime/Lib/site-packages/onnxruntime/datasets/_pybind_state.py with huggingface_hub

Browse files
runtime/Lib/site-packages/onnxruntime/datasets/_pybind_state.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -------------------------------------------------------------------------
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License.
4
+ # --------------------------------------------------------------------------
5
+ """
6
+ Ensure that dependencies are available and then load the extension module.
7
+ """
8
+ import os
9
+ import platform
10
+ import warnings
11
+
12
+ from . import _ld_preload # noqa: F401
13
+
14
+ if platform.system() == "Windows":
15
+ from . import version_info
16
+
17
+ # If on Windows, check if this import error is caused by the user not installing the 2019 VC Runtime
18
+ # The VC Redist installer usually puts the VC Runtime dlls in the System32 folder, but it may also be found
19
+ # in some other locations.
20
+ # TODO, we may want to try to load the VC Runtime dlls instead of checking if the hardcoded file path
21
+ # is valid, and raise ImportError if the load fails
22
+ if version_info.vs2019 and platform.architecture()[0] == "64bit":
23
+ system_root = os.getenv("SystemRoot") or "C:\\Windows"
24
+ if not os.path.isfile(os.path.join(system_root, "System32", "vcruntime140_1.dll")):
25
+ warnings.warn("Please install the 2019 Visual C++ runtime and then try again. "
26
+ "If you've installed the runtime in a non-standard location "
27
+ "(other than %SystemRoot%\\System32), "
28
+ "make sure it can be found by setting the correct path.")
29
+
30
+
31
+
32
+ from .onnxruntime_pybind11_state import * # noqa
33
+