Describe the bug
is_torch_xla_version() in src/diffusers/utils/import_utils.py guards with if not is_torch_xla_available — but is_torch_xla_available is the function defined in the same module, not the cached boolean. A function object is always truthy, so the guard never short-circuits when torch_xla is absent.
When torch_xla is not installed, parse(_torch_xla_version) then operates on an invalid/empty version string instead of returning False.
Expected behavior
The guard should check the module-level boolean _torch_xla_available:
if not _torch_xla_available:
return False
Found while auditing version checks in import_utils. Fix incoming in PR #14513.
Describe the bug
is_torch_xla_version()insrc/diffusers/utils/import_utils.pyguards withif not is_torch_xla_available— butis_torch_xla_availableis the function defined in the same module, not the cached boolean. A function object is always truthy, so the guard never short-circuits when torch_xla is absent.When torch_xla is not installed,
parse(_torch_xla_version)then operates on an invalid/empty version string instead of returningFalse.Expected behavior
The guard should check the module-level boolean
_torch_xla_available:Found while auditing version checks in import_utils. Fix incoming in PR #14513.