diff --git a/torchtune/utils/_import_guard.py b/torchtune/utils/_import_guard.py index 5e6ab5309..582c79022 100644 --- a/torchtune/utils/_import_guard.py +++ b/torchtune/utils/_import_guard.py @@ -14,7 +14,10 @@ ) _TORCHDATA_MIN_VERSION = "0.10.0" -if importlib.util.find_spec("torchdata.nodes") is not None: +if ( + importlib.util.find_spec("torchdata") is not None + and importlib.util.find_spec("torchdata.nodes") is not None +): _TORCHDATA_INSTALLED = True else: _TORCHDATA_INSTALLED = False