Skip to content

simCLR #1278

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

Merged
merged 179 commits into from
Sep 9, 2021
Merged

simCLR #1278

merged 179 commits into from
Sep 9, 2021

Conversation

I8dNLo
Copy link
Contributor

@I8dNLo I8dNLo commented Aug 18, 2021

Before submitting (checklist)

  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contribution guide?
  • Did you check the code style? catalyst-make-codestyle && catalyst-check-codestyle (pip install -U catalyst-codestyle).
  • Did you make sure to update the docs? We use Google format for all the methods and classes.
  • Did you check the docs with make check-docs?
  • Did you write any new necessary tests?
  • Did you check that your code passes the unit tests pytest . ?
  • Did you add your new functionality to the docs?
  • Did you update the CHANGELOG?
  • Did you run colab minimal CI/CD with latest and minimal requirements?

Description

Related Issue

Type of Change

  • Examples / docs / tutorials / contributors update
  • Bug fix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves an existing feature)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

PR review

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

FAQ

Please review the FAQ before submitting an issue:

@pep8speaks
Copy link

pep8speaks commented Aug 18, 2021

Hello @gr33n-made! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 76:100: E501 line too long (103 > 99 characters)

Line 266:25: W291 trailing whitespace

Line 29:78: E231 missing whitespace after ','
Line 105:100: E501 line too long (101 > 99 characters)
Line 116:100: E501 line too long (101 > 99 characters)
Line 157:96: E231 missing whitespace after ','
Line 185:1: E302 expected 2 blank lines, found 1

Line 58:82: E231 missing whitespace after ','

Comment last updated at 2021-09-09 05:26:47 UTC

dmitrijrudenko added 2 commits August 19, 2021 01:12
>
>
Co-authored-by: Nimrais nikola.lukashuk@gmail.com
@I8dNLo I8dNLo changed the title Draft: simCLR simCLR Aug 23, 2021
def __init__(self, dataset: Dataset, transforms):
super().__init__()
self.transforms = transforms
self._dataset = dataset
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need this?

Copy link
Contributor

@Nimrais Nimrais Aug 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean the simCLR wrapper at all?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, I mean, that you have 2 references for 1 object: dataset and _dataset

pos_loss = self.cosineSim(features1, features2).sum(dim=0) / self.tau
list_neg_loss = [
torch.exp(self.cosineSim(features1, torch.roll(features2, i, 1)) / self.tau)
for i in range(0, bs)
Copy link
Contributor

@Nimrais Nimrais Aug 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you would follow the simCLR paper you could see that the denominator of the loss contains a positive part. During the training, our aim is to maximize log PosPairSim/(All other similarities). All other similarities include PosSim too.

input_key: str = "features",
target_key: str = "target",
loss_key: str = "loss",
augemention_prefix: str = "aug",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

@Scitator Scitator merged commit 6371024 into catalyst-team:master Sep 9, 2021
@Nimrais Nimrais mentioned this pull request Sep 9, 2021
21 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants