Repository navigation
[Feature] Add Spectral Contrastive Learning - #452
Open
Chris-ZiyuK wants to merge 6 commits into
Open
Chris-ZiyuK wants to merge 6 commits into
Chris-ZiyuK wants to merge 6 commits into
Conversation
Contributor
|
Please support the dict-based training contract, add the top-level export, and test DDP gradients with real processes rather than mocked gathering. |
…s with real processes
Chris-ZiyuK
marked this pull request as draft
October 19, 2026 19:35
Keep ball-projection gradients finite for tiny inputs, expose composable loss and forward APIs, and seed identical benchmark architectures before initialization. Run real CPU DDP regressions in CI and reject crashed or timed-out workers.
Chris-ZiyuK
marked this pull request as ready for review
October 21, 2026 15:24
Collaborator
|
Hi @Chris-ZiyuK, I've gone through the changes, and everything Randall asked for is addressed. Please also check the items below, which weren't raised in the first review:
Since these weren't in the first review, this comment doesn't count as an extra review round. |
The CIFAR-10 benchmark passes SpectralCL itself to Manager instead of wrapping it in a separate Module, and a unit test trains SpectralCL with Manager and checks checkpoint resume. Remove the CPU/gloo CI job, the TESTING.md notes and the run_distributed changes; the spectral DDP gradient test stays with the other distributed tests.
Author
|
Hi @Leon-Leyang ! Thanks for the review.
|
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #452 +/- ##
=======================================
Coverage 98.17% 98.18%
=======================================
Files 163 165 +2
Lines 16406 16496 +90
=======================================
+ Hits 16107 16197 +90
Misses 299 299 🚀 New features to boost your workflow:
|
Leon-Leyang
approved these changes
Dec 3, 2026
Leon-Leyang
left a comment
Collaborator
There was a problem hiding this comment.
Hi @Chris-ZiyuK, I've gone through the changes and it looks good to me.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds Spectral Contrastive Learning as
spt.SpectralCL, with a reusableSpectralContrastiveLossandspt.forward.spectral.SpectralCLtrains directly withspt.Manager. Includes documentation, release notes and a CIFAR-10 benchmark.DDP loss and parameter gradients are tested with two real CPU/gloo processes. Tests also cover zero/tiny-input gradients and training
SpectralCLwithspt.Manager, including checkpoint resume.CIFAR-10 results
ResNet-18, 200 epochs, batch size 512, seed 0, one RTX 3090. Both objectives use the same backbone, projector and training setup.
Final-epoch online scores from one run per configuration. The paper uses offline linear evaluation.
Testing
Feature tests, real-process DDP tests and pre-commit pass. Docs build with the same warnings as base. The full macOS unit suite has three failures that also occur on the unchanged base; GitHub CI is awaiting maintainer approval.
Checklist