lightly-ai / lightly

A python library for self-supervised learning on images.
https://docs.lightly.ai/self-supervised-learning/
MIT License
3.09k stars 264 forks source link

Add timm version check #1487

Closed guarin closed 8 months ago

guarin commented 8 months ago

Changes

This fixes import issues if users have an older version of timm installed. For details see:

guarin commented 8 months ago

FYI @adamjstewart. Would this fix the problem in torchgeo?

codecov[bot] commented 8 months ago

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (25894a9) 84.40% compared to head (7b458e8) 84.40%.

Files Patch % Lines
lightly/utils/dependency.py 75.00% 4 Missing :warning:
lightly/models/utils.py 50.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1487 +/- ## ========================================== - Coverage 84.40% 84.40% -0.01% ========================================== Files 139 140 +1 Lines 5777 5783 +6 ========================================== + Hits 4876 4881 +5 - Misses 901 902 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

adamjstewart commented 8 months ago

Packaging is no longer needed now right?

guarin commented 8 months ago

Packaging is no longer needed now right?

Yes exactly :) Plus we actually verify whether the required classes are there instead of relying on the version.

The change should also speed up importing lightly in environments where torchvision and/or timm are installed as we now only import them when needed.

adamjstewart commented 8 months ago

Thanks for the quick fix @guarin, glad we'll be able to use future timm versions again!