diff --git a/optimum/intel/utils/import_utils.py b/optimum/intel/utils/import_utils.py index 7b2eeb540e..8f20752e5f 100644 --- a/optimum/intel/utils/import_utils.py +++ b/optimum/intel/utils/import_utils.py @@ -17,7 +17,6 @@ import sys from collections import OrderedDict from typing import Union - from packaging.version import Version, parse @@ -205,7 +204,10 @@ def is_torch_version(operation: str, version: str): """ if not _torch_available: return False - return compare_versions(parse(_torch_version), operation, version) + + import torch + + return compare_versions(parse(parse(torch.__version__).base_version), operation, version) def is_ipex_version(operation: str, version: str):