From 2e899591c9eb46cf7e4256125176f913e209db1d Mon Sep 17 00:00:00 2001 From: Lionel Date: Tue, 12 Nov 2024 15:02:25 +0100 Subject: [PATCH] fix import when transforms.v2 not available --- lightly/transforms/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lightly/transforms/__init__.py b/lightly/transforms/__init__.py index 566c11f0a..5474d7600 100644 --- a/lightly/transforms/__init__.py +++ b/lightly/transforms/__init__.py @@ -8,7 +8,6 @@ # Copyright (c) 2020. Lightly AG and its affiliates. # All Rights Reserved -from lightly.transforms.add_grid_transform import AddGridTransform from lightly.transforms.aim_transform import AIMTransform from lightly.transforms.amplitude_rescale_transform import AmplitudeRescaleTranform from lightly.transforms.byol_transform import ( @@ -55,3 +54,7 @@ from lightly.transforms.vicreg_transform import VICRegTransform, VICRegViewTransform from lightly.transforms.vicregl_transform import VICRegLTransform, VICRegLViewTransform from lightly.transforms.wmse_transform import WMSETransform +from lightly.utils.dependency import torchvision_transforms_v2_available + +if torchvision_transforms_v2_available(): + from lightly.transforms.add_grid_transform import AddGridTransform