Skip to content

Commit

Permalink
fix(scripts): check for ORT modules
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Mar 18, 2023
1 parent 84718e5 commit c465b61
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion api/scripts/check-env.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

REQUIRED_MODULES = ["onnx", "diffusers", "safetensors", "torch"]

REQUIRED_RUNTIME = [
RUNTIME_MODULES = [
"onnxruntime",
"onnxruntime_gpu",
"onnxruntime_rocm",
Expand All @@ -26,6 +26,21 @@ def check_modules() -> List[str]:
return results


def check_runtimes() -> List[str]:
results = []
for name in RUNTIME_MODULES:
try:
__import__(name)
module_version = version(name)
results.append(
f"runtime module {name} is present at version {module_version}"
)
except ImportError as e:
results.append(f"unable to import runtime module {name}: {e}")

return results


def check_providers() -> List[str]:
results = []
try:
Expand All @@ -46,6 +61,7 @@ def check_providers() -> List[str]:

ALL_CHECKS = [
check_modules,
check_runtimes,
check_providers,
]

Expand Down

0 comments on commit c465b61

Please sign in to comment.