Skip to content

Commit

Permalink
chore(rapidocr_onnxruntime): Optim tips of infer_engine
Browse files Browse the repository at this point in the history
  • Loading branch information
SWHL committed May 18, 2024
1 parent de44841 commit 7528fa9
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions python/rapidocr_onnxruntime/utils/infer_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def _check_cuda(self) -> bool:
return True

self.logger.warning(
"%s is not in available providers (%s), default use of %s inference.",
"%s is not in available providers (%s). Use %s inference by default.",
CUDA_EP,
self.had_providers,
self.had_providers[0],
Expand Down Expand Up @@ -127,23 +127,26 @@ def _check_dml(self) -> bool:
cur_os = platform.system()
if cur_os != "Windows":
self.logger.warning(
"DirectML is only supported in Windows OS. The current OS is %s", cur_os
"DirectML is only supported in Windows OS. The current OS is %s. Use %s inference by default.",
cur_os,
self.had_providers[0],
)
return False

cur_window_version = int(platform.release().split(".")[0])
if cur_window_version < 10:
self.logger.warning(
"DirectML is only supported in Windows 10 and above OS. The current Windows version is %s",
"DirectML is only supported in Windows 10 and above OS. The current Windows version is %s. Use %s inference by default.",
cur_window_version,
self.had_providers[0],
)
return False

if DIRECTML_EP in self.had_providers:
return True

self.logger.warning(
"%s is not in available providers (%s), default use of %s inference.",
"%s is not in available providers (%s). Use %s inference by default.",
DIRECTML_EP,
self.had_providers,
self.had_providers[0],
Expand Down

0 comments on commit 7528fa9

Please sign in to comment.