Skip to content

Commit

Permalink
Add check for LayerType
Browse files Browse the repository at this point in the history
  • Loading branch information
guarin committed Jan 26, 2024
1 parent e67c866 commit 81f44dc
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lightly/utils/dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
@functools.lru_cache(maxsize=1)
def torchvision_vit_available() -> bool:
try:
# Requires torchvision >=0.12
import torchvision.models.vision_transformer
import torchvision.models.vision_transformer # Requires torchvision >=0.12
except (

Check warning on line 8 in lightly/utils/dependency.py

View check run for this annotation

Codecov / codecov/patch

lightly/utils/dependency.py#L8

Added line #L8 was not covered by tests
RuntimeError, # Different CUDA versions for torch and torchvision
OSError, # Different CUDA versions for torch and torchvision (old)
Expand All @@ -19,8 +18,8 @@ def torchvision_vit_available() -> bool:
@functools.lru_cache(maxsize=1)
def timm_vit_available() -> bool:
try:
# Requires timm >= 0.9.9
import timm.models.vision_transformer
import timm.models.vision_transformer # Requires timm >= 0.3.3
from timm.layers import LayerType # Requires timm >= 0.9.9

Check warning on line 22 in lightly/utils/dependency.py

View check run for this annotation

Codecov / codecov/patch

lightly/utils/dependency.py#L22

Added line #L22 was not covered by tests
except ImportError:
return False
else:
Expand Down

0 comments on commit 81f44dc

Please sign in to comment.