diff --git a/lightly/__init__.py b/lightly/__init__.py index 166914146..bd9a3b238 100644 --- a/lightly/__init__.py +++ b/lightly/__init__.py @@ -79,10 +79,11 @@ import os +from typing import Optional + import packaging.version -from packaging.version import Version as _Version from packaging.version import InvalidVersion -from typing import Optional +from packaging.version import Version as _Version # see if torchvision vision transformer is available try: diff --git a/lightly/models/modules/__init__.py b/lightly/models/modules/__init__.py index ec5dfda49..2ab86a1a1 100644 --- a/lightly/models/modules/__init__.py +++ b/lightly/models/modules/__init__.py @@ -8,6 +8,8 @@ # Copyright (c) 2021. Lightly AG and its affiliates. # All Rights Reserved +from packaging.version import Version as _Version + from lightly import _timm_available, _timm_version, _torchvision_vit_available from lightly.models.modules.heads import ( BarlowTwinsProjectionHead, @@ -27,7 +29,6 @@ SwaVPrototypes, ) from lightly.models.modules.nn_memory_bank import NNMemoryBankModule -from packaging.version import Version as _Version if _torchvision_vit_available: # Requires torchvision >=0.12