Skip to content
This repository was archived by the owner on Jan 20, 2026. It is now read-only.

Swav#239

Merged
ananyahjha93 merged 55 commits intomasterfrom
swav
Oct 19, 2020
Merged

Swav#239
ananyahjha93 merged 55 commits intomasterfrom
swav

Conversation

@ananyahjha93
Copy link
Copy Markdown
Contributor

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure to update the docs?
  • Did you write any new necessary tests?

What does this PR do?

Adapts swav from official implementation.

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.

Did you have fun?

Make sure you had fun coding 🙃

@pep8speaks
Copy link
Copy Markdown

pep8speaks commented Sep 16, 2020

Hello @ananyahjha93! Thanks for updating this PR.

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2020-10-19 16:09:54 UTC

@mergify mergify Bot requested a review from Borda September 16, 2020 22:08
@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 16, 2020

Codecov Report

Merging #239 into master will decrease coverage by 1.85%.
The diff coverage is 66.95%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #239      +/-   ##
==========================================
- Coverage   83.91%   82.06%   -1.86%     
==========================================
  Files          91       97       +6     
  Lines        4861     5441     +580     
==========================================
+ Hits         4079     4465     +386     
- Misses        782      976     +194     
Flag Coverage Δ
#cpu 23.42% <19.10%> (-0.54%) ⬇️
#pytest 23.42% <19.10%> (-0.54%) ⬇️
#unittests 81.49% <66.09%> (-1.89%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ts/models/self_supervised/swav/swav_online_eval.py 21.31% <21.31%> (ø)
pl_bolts/models/self_supervised/swav/transforms.py 66.66% <66.66%> (ø)
...l_bolts/models/self_supervised/swav/swav_resnet.py 70.20% <70.20%> (ø)
...l_bolts/models/self_supervised/swav/swav_module.py 74.35% <74.35%> (ø)
pl_bolts/models/self_supervised/__init__.py 100.00% <100.00%> (ø)
pl_bolts/models/self_supervised/amdim/datasets.py 61.11% <100.00%> (ø)
pl_bolts/models/self_supervised/swav/__init__.py 100.00% <100.00%> (ø)
...olts/models/self_supervised/swav/swav_finetuner.py 100.00% <100.00%> (ø)
pl_bolts/datasets/base_dataset.py 95.45% <0.00%> (-4.55%) ⬇️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d32d3eb...1ccfbaa. Read the comment docs.

Comment thread pl_bolts/models/self_supervised/swav/swav_finetuner.py Outdated
@Borda Borda added the fix fixing issues... label Sep 17, 2020
Comment thread pl_bolts/models/self_supervised/swav/swav_finetuner.py Outdated
Comment thread pl_bolts/models/self_supervised/swav/swav_finetuner.py
Comment thread pl_bolts/models/self_supervised/swav/swav_module.py
Comment thread pl_bolts/models/self_supervised/swav/transforms.py
Copy link
Copy Markdown
Contributor

@nateraw nateraw left a comment

Choose a reason for hiding this comment

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

Can we avoid passing + assigning datamodule to model as self.datamodule? I'd like to get rid of this pattern entirely. (#207 )


if prob < self.p:
sigma = (self.max - self.min) * np.random.random_sample() + self.min
sample = cv2.GaussianBlur(sample, (self.kernel_size, self.kernel_size), sigma)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

)

trainer = pl.Trainer(
gpus=0, fast_dev_run=False, max_epochs=1, default_root_dir=tmpdir, max_steps=3
Copy link
Copy Markdown
Contributor

@teddykoker teddykoker Oct 19, 2020

Choose a reason for hiding this comment

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

Can we at least do a fast_dev_run to test?

Comment thread requirements.txt Outdated

class GaussianBlur(object):
# Implements Gaussian blur as described in the SimCLR paper
def __init__(self, kernel_size, p=0.5, min=0.1, max=2.0):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Might not want to use min and max since these are Python built-ins. Could lead to potential issues.

Comment thread tests/models/self_supervised/test_models.py Outdated
Comment thread requirements.txt Outdated
@@ -1,2 +1,2 @@
pytorch-lightning>=1.0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

reverse order

torch>=1.6
pytorch-lightning>=1.0

Comment thread pl_bolts/models/self_supervised/swav/swav_finetuner.py Outdated
Comment thread pl_bolts/models/self_supervised/swav/swav_finetuner.py Outdated
Comment thread pl_bolts/models/self_supervised/swav/swav_online_eval.py
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

fix fixing issues...

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants