Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SimCLR loss calculation seems deviating from original paper #609

Closed
likenneth opened this issue Mar 31, 2021 · 3 comments · Fixed by #613
Closed

SimCLR loss calculation seems deviating from original paper #609

likenneth opened this issue Mar 31, 2021 · 3 comments · Fixed by #613
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@likenneth
Copy link

likenneth commented Mar 31, 2021

🐛 Bug

as title

To Reproduce

I the denominator shall substract exp(1/temp) rather than exp(1)

Code sample

Suspect at here:
https://github.com/PyTorchLightning/lightning-bolts/blob/9044ed143c7f1e20164de12208f451c7a8d9718f/pl_bolts/models/self_supervised/simclr/simclr_module.py#L284

Expected behavior

I haven't tested whether my proposed implementation would improve performance, I am suggesting any deviation from original paper be noted.

@likenneth likenneth added fix fixing issues... help wanted Extra attention is needed labels Mar 31, 2021
@github-actions
Copy link

Hi! thanks for your contribution!, great first issue!

@Moadab-AI
Copy link

Actually exp(1/Temperature) should be subtracted not exp(-Temperature)

@likenneth
Copy link
Author

Actually exp(1/Temperature) should be subtracted not exp(-Temperature)

Exactly! I revised my comments.
BTW, I tried the new formula on my project, which is based on Pytorch Lightning SimCLR implementation, and found no drastic difference in performance.

@Borda Borda added bug Something isn't working and removed fix fixing issues... labels Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants