Skip to content

Commit

Permalink
Fix ORT detection (#1636)
Browse files Browse the repository at this point in the history
do not use metadata.version
  • Loading branch information
fxmarty authored Jan 10, 2024
1 parent 8c6b6b6 commit 7852dc5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion optimum/utils/import_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ def _is_package_available(pkg_name: str, return_version: bool = False) -> Union[


_onnx_available = _is_package_available("onnx")
_onnxruntime_available = _is_package_available("onnxruntime")

# importlib.metadata.version seem to not be robust with the ONNX Runtime extensions (`onnxruntime-gpu`, etc.)
_onnxruntime_available = importlib.util.find_spec("onnxruntime") is not None

_pydantic_available = _is_package_available("pydantic")
_accelerate_available = _is_package_available("accelerate")
_diffusers_available = _is_package_available("diffusers")
Expand Down

0 comments on commit 7852dc5

Please sign in to comment.