lightly icon indicating copy to clipboard operation
lightly copied to clipboard

feat: add LeJEPA transform

Open gabrielfruet opened this issue 6 months ago • 8 comments

Summary

Adds a new LeJEPATransform for LeJEPA-style multi-view augmentation. The exact augmentation configuration is not explicit in the paper, they only say they use 2 global views and 2 local views.

What’s included

  • New lightly.transforms.lejepa_transform implementation
  • Export from lightly.transforms
  • Docs entry in docs/source/lightly.transforms.rst
  • Unit test coverage for PIL input / multi-view output shape

Notes

  • Produces 2 global views + configurable local views
  • Supports crop/flip/rotation/color jitter/blur/solarization/normalization options

Testing

  • Added tests/transforms/test_lejepa_transform.py

gabrielfruet avatar May 13 '26 15:05 gabrielfruet

Codecov Report

:x: Patch coverage is 55.17241% with 13 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 86.13%. Comparing base (5aa9d51) to head (89e4807).

Files with missing lines Patch % Lines
lightly/transforms/lejepa_transform.py 53.57% 13 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1924      +/-   ##
==========================================
- Coverage   86.26%   86.13%   -0.13%     
==========================================
  Files         170      171       +1     
  Lines        7104     7133      +29     
==========================================
+ Hits         6128     6144      +16     
- Misses        976      989      +13     

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

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar May 13 '26 15:05 codecov[bot]

Hi @gabrielfruet - happy to move this along, let me know if you need a helping hand. Or if there is any other LeJEPA work pending, happy to take it up.

RecreationalMath avatar May 27 '26 18:05 RecreationalMath

Hey @RecreationalMath thank you!

I decided to not go over with the LeJEPA transform implementation since it's basically a DINO with some different parameters.

IDK if that's is of your interest, but are you into world models ? (e.g LeWM, SubJEPA and so on)

gabrielfruet avatar May 28 '26 17:05 gabrielfruet

Looking at it, the overlap with DINO is my read too.

IDK if that's is of your interest, but are you into world models ? (e.g LeWM, SubJEPA and so on)

Yes. I've been reading the papers and looking at the trajectory. Any plans to implement them in lightly?

RecreationalMath avatar May 29 '26 14:05 RecreationalMath

We can discuss more into it also. We think it's valuable to have something of world models at LightlySSL. Any suggestions, ideas, paper are surely welcome :)

Currently we are prioritizing LightlyTrain, so I'm not having much time to research world models stuff for LightlySSL.

Since the philosophy of LightlySSL is providing building blocks, implementation of losses of world models, or predictor architectures are surely welcome.

FYI, we were able to benchmark LeJEPA and the metrics are very similar to the papers! Thank you so much for the high quality contributions.

gabrielfruet avatar May 29 '26 16:05 gabrielfruet

Good to hear the LeJEPA benchmark held up against the paper.

The smallest natural building blocks for LeWM I see are a JEPA-style predictor module and a next-embedding prediction loss. SIGReg is already in place as the regularizer, so the new surface is small. Sub-JEPA's MultiSubspaceSIGReg can follow afterwards.

Shall I open a tracking issue with the proposed scope first for a sanity check?

RecreationalMath avatar May 29 '26 18:05 RecreationalMath

I would appreciate if you could open an issue for that. We can better refine the scope.

We are very open to suggestions in this world model field, so feel free to be creative and give suggestions.

gabrielfruet avatar May 29 '26 19:05 gabrielfruet

Opened #1934 with some initial thoughts, findings and reasoning. Would appreciate your input there, @gabrielfruet

RecreationalMath avatar Jun 01 '26 19:06 RecreationalMath