Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Fix sampler instance support #1204

Merged
merged 5 commits into from
Mar 1, 2022
Merged

Fix sampler instance support #1204

merged 5 commits into from
Mar 1, 2022

Conversation

ethanwharris
Copy link
Collaborator

@ethanwharris ethanwharris commented Mar 1, 2022

What does this PR do?

Fixes #1197

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 your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests? [not needed for typos/docs]
  • Did you verify new and existing tests pass locally with your changes?
  • If you made a notable change (that affects users), did you update the CHANGELOG?

PR review

  • Is this pull request ready for review? (if not, please submit in draft mode)

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 🙃

@mergify mergify bot removed the has conflicts label Mar 1, 2022
@ethanwharris ethanwharris added the bug / fix Something isn't working label Mar 1, 2022
@ethanwharris ethanwharris added this to the 0.7.x milestone Mar 1, 2022

.. doctest::

>>> datamodule = DataModule(train_input, sampler=WeightedRandomSampler([0.1, 0.5], 2), batch_size=1)
Copy link
Member

Choose a reason for hiding this comment

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

so this is the alternative for CrossEntropyLoss weights?

@codecov
Copy link

codecov bot commented Mar 1, 2022

Codecov Report

Merging #1204 (a3eda82) into master (8abc10a) will decrease coverage by 8.21%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1204      +/-   ##
==========================================
- Coverage   90.96%   82.74%   -8.22%     
==========================================
  Files         284      284              
  Lines       12689    12691       +2     
==========================================
- Hits        11542    10501    -1041     
- Misses       1147     2190    +1043     
Flag Coverage Δ
unittests 82.74% <100.00%> (-8.22%) ⬇️

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

Impacted Files Coverage Δ
flash/core/data/data_module.py 93.79% <100.00%> (-0.31%) ⬇️
flash/core/integrations/icevision/transforms.py 18.24% <0.00%> (-75.00%) ⬇️
...lash/image/embedding/vissl/transforms/multicrop.py 27.27% <0.00%> (-69.70%) ⬇️
flash/core/integrations/icevision/data.py 28.88% <0.00%> (-66.67%) ⬇️
flash/image/embedding/heads/vissl_heads.py 36.36% <0.00%> (-63.64%) ⬇️
flash/image/detection/input.py 36.66% <0.00%> (-63.34%) ⬇️
...ash/image/classification/integrations/baal/loop.py 32.08% <0.00%> (-62.69%) ⬇️
flash/core/integrations/icevision/backbones.py 33.33% <0.00%> (-60.01%) ⬇️
...ash/image/classification/integrations/baal/data.py 34.34% <0.00%> (-59.60%) ⬇️
...age/face_detection/backbones/fastface_backbones.py 42.10% <0.00%> (-57.90%) ⬇️
... and 47 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 8abc10a...a3eda82. Read the comment docs.

Copy link
Contributor

@krshrimali krshrimali left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! Just minor nit (whitespace).

tests/core/data/test_data_module.py Outdated Show resolved Hide resolved
mergify bot and others added 2 commits March 1, 2022 14:44
Co-authored-by: Kushashwa Ravi Shrimali <kushashwaravishrimali@gmail.com>
@ethanwharris ethanwharris enabled auto-merge (squash) March 1, 2022 15:05
@ethanwharris ethanwharris merged commit f6817b6 into master Mar 1, 2022
@ethanwharris ethanwharris deleted the bugfix/samplers branch March 1, 2022 15:20
ethanwharris added a commit that referenced this pull request Mar 1, 2022
Co-authored-by: Kushashwa Ravi Shrimali <kushashwaravishrimali@gmail.com>
ethanwharris added a commit that referenced this pull request Mar 1, 2022
Co-authored-by: Kushashwa Ravi Shrimali <kushashwaravishrimali@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug / fix Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting a Sampler with Arguments is not working with ImageClassificationData factory methods
3 participants