SparK Implementation
Addresses #1462
Continues #1750
Inspired by: https://github.com/keyu-tian/SparK
https://arxiv.org/pdf/2301.03580
@guarin Tried to adhere to the patterns you listed on @johnsutor 's PR.
I still need to clean a bit of unused code, but i think what we have work for now.
Thanks for the PR! I'll have a look ASAP, might take a couple of days.
hey @guarin, wanted to understand some things.
is lightly repo still actively mantained? i'm not seeing much community contributions lately, last commit was made 5 months ago.
just wanted to get some context on how things are going historically, and what are the plans for the repo.
i know that lightly-train is still actively maintained. was it a replacement to detriment of lightly? i know that they are fundamentally different and i think lightly-train doesn't even use lightly under the hood(might be wrong).
FYI, i will be actively maintaining and implementing some methods from now on. I'm very interested in SSL, and i think Lightly is the gold standard for that.
I'm drafting PRs for LeJEPA also.
If there is a list of wanted features, please let me know!
Hi, both are maintained :) Just didn't have a lot of time to work on the lightly repo recently. This repo is for SSL research whereas LightlyTrain is more targeted towards production/industry use-cases and also covers fine-tuning etc.
New methods are the most interesting contributions for us. Especially recent methods like:
- JEPAs
- Pixio
There are also some opportunities to improve the benchmarking code. Let me know if you are interested in this.
Thanks a lot for the interest and contributions!
thanks guarin! makes total sense regarding the research vs production split.
i'm wrapping up the lejepa loss function pr now, then i'll continue implementing the full module. pixio is next. since it deals with dense prediction, it fits my lidar/3d background perfectly.
btw, i just applied for the "machine learning engineer (oss)" role from Lightly. really hoping to help manage the repo officially. would love for you to treat these PRs as a trial run to show how i work :)
Quick heads-up @gabrielfruet : Currently reviewing it, but might take until the beginning of next week until I'll finish since I have quite a lot of other things to do.
Sorry @gabrielfruet that it's taking longer. But I blocked myself some time today to do it. :)
Hi @liopeer, that's fine! I personally understand.
I will address some issues in this PR, that i acknowledged through the modifications that Igor made to my LeJEPA PR.
But would still be nice to have some direction here! Just to guarantee we're in the same page.
FYI, you can update the branch with latest main. I should resolve the CI issues!
@gabrielfruet I'll try to help a bit in the next few days so that we can merge this. Pushed a few cleanups and a context variable for taking care of that ugly global tensor. Feel free to also reach out on Discord for slightly faster interaction.
Hi @liopeer, sorry for the delay. I got really sick recently.
I made some comments and reviews, but i forgot to submit them. I submitted them now.
Codecov Report
:x: Patch coverage is 53.89408% with 148 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 84.78%. Comparing base (ee30cd4) to head (9687035).
:warning: Report is 8 commits behind head on master.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| lightly/models/modules/sparse_spark.py | 50.00% | 145 Missing :warning: |
| lightly/loss/sparse_spark.py | 89.65% | 3 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #1892 +/- ##
==========================================
- Coverage 86.10% 84.78% -1.32%
==========================================
Files 168 171 +3
Lines 6979 7375 +396
==========================================
+ Hits 6009 6253 +244
- Misses 970 1122 +152
: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.
@liopeer If you wish i could increase test coverage. If not necessary let me know.
I'll take a look into these type errors (Check 3.7)
FYI, i still have to address these python 3.7 errors. Do we still support python 3.7?
Hi @liopeer , when possible, can you approve these workflows? I think i fixed most of the issues. Also, the 3.7 tests are still relevant?
Also if you have any other suggestion for the code, let me know!
- Tests are green
- Formatted the code
- Generated notebooks
Quick question: One of my modules depends on timm. Should i port the necessary classes to our repo or should i declare it as a dependency?
from timm.models.layers import DropPath, trunc_normal_
- Tests are green
- Formatted the code
- Generated notebooks
Quick question: One of my modules depends on
timm. Should i port the necessary classes to our repo or should i declare it as a dependency?from timm.models.layers import DropPath, trunc_normal_
If timm is not yet a dependency we should copy over the files. You can add a note that you copied them from timm.
There are two options here. I was taking a look and we also have this pattern for timm's ViT to skip tests on minimal CI
https://github.com/lightly-ai/lightly/blob/904c50a7cc8bff9dbc0863a99bc71c84422322a8/lightly/utils/dependency.py#L27-L44
We already have a test that depends on DropPath and is being just skipped if timm is not available. Since we are already using this pattern, i'll stick to it.
https://github.com/lightly-ai/lightly/blob/904c50a7cc8bff9dbc0863a99bc71c84422322a8/tests/models/test_ModelUtils.py#L923-L938
I tested with py37 on my environment and the workflows went green. I'm just worried about the test coverage. I'll take a look into it when possible.