Skip to content

Commit

Permalink
update dependency check
Browse files Browse the repository at this point in the history
  • Loading branch information
liopeer committed Jan 13, 2025
1 parent baa11ee commit 37ebd7c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lightly/utils/dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,16 @@ def timm_vit_available() -> bool:

@functools.lru_cache(maxsize=1)
def torchvision_transforms_v2_available() -> bool:
"""Checks if torchvision supports the transforms.v2 API.
"""Checks if torchvision supports the v2 transforms API with the `tv_tensors`
module. Checking for the availability of the `transforms.v2` is not sufficient
since it is available in torchvision >= 0.15.1, but the `tv_tensors` module is
only available in torchvision >= 0.16.0.
Returns:
True if transforms.v2 are available, False otherwise
"""
try:
from torchvision.tv_tensors import Mask
from torchvision import tv_tensors
except ImportError:
return False
return True

0 comments on commit 37ebd7c

Please sign in to comment.