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

[feat] Add support for running_stage and current_fn in all Preprocess hook (1 / 2) #200

Merged
merged 15 commits into from
Apr 1, 2021

Conversation

tchaton
Copy link
Contributor

@tchaton tchaton commented Mar 31, 2021

What does this PR do?

This PR makes each Preprocess hook aware of its current function name and running_state.

class CustomPreprocess(Preprocess):

        def train_per_sample_transform_on_device(self, ...):
               assert self.training
               assert self.current_fn == "per_sample_transform_on_device"

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 🙃

@tchaton tchaton added this to the 0.2 milestone Mar 31, 2021
@tchaton tchaton self-assigned this Mar 31, 2021
@tchaton tchaton changed the title [feat] Add support for running_stage and current_fn in all Preprocess hook [feat] Add support for running_stage and current_fn in all Preprocess hook (1 / 2) Mar 31, 2021
@tchaton tchaton mentioned this pull request Mar 31, 2021
8 tasks
@codecov
Copy link

codecov bot commented Mar 31, 2021

Codecov Report

Merging #200 (84eaa68) into master (62472d7) will increase coverage by 0.59%.
The diff coverage is 95.36%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #200      +/-   ##
==========================================
+ Coverage   85.11%   85.70%   +0.59%     
==========================================
  Files          54       54              
  Lines        2391     2483      +92     
==========================================
+ Hits         2035     2128      +93     
+ Misses        356      355       -1     
Flag Coverage Δ
unittests 85.70% <95.36%> (+0.59%) ⬆️

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

Impacted Files Coverage Δ
flash/data/data_module.py 72.53% <ø> (ø)
flash/vision/classification/data.py 87.43% <85.29%> (-1.60%) ⬇️
flash/data/data_pipeline.py 87.36% <92.30%> (+0.18%) ⬆️
flash/data/auto_dataset.py 95.77% <92.85%> (-0.12%) ⬇️
flash/data/process.py 84.50% <97.43%> (+6.62%) ⬆️
flash/data/batch.py 76.85% <97.50%> (+6.26%) ⬆️
flash/core/classification.py 100.00% <100.00%> (ø)
flash/core/model.py 94.01% <100.00%> (+0.34%) ⬆️
flash/data/utils.py 96.84% <100.00%> (+4.38%) ⬆️
flash/tabular/classification/data/data.py 88.63% <100.00%> (ø)
... and 2 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 62472d7...84eaa68. Read the comment docs.

flash/core/model.py Outdated Show resolved Hide resolved
Copy link
Contributor

@edgarriba edgarriba left a comment

Choose a reason for hiding this comment

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

Minor suggestions for typing, few comments and open questions.

flash/data/auto_dataset.py Outdated Show resolved Hide resolved
flash/data/batch.py Outdated Show resolved Hide resolved
flash/data/batch.py Show resolved Hide resolved
flash/data/batch.py Outdated Show resolved Hide resolved
flash/data/batch.py Show resolved Hide resolved
flash/vision/classification/data.py Show resolved Hide resolved
flash/vision/classification/data.py Show resolved Hide resolved
flash/vision/classification/data.py Show resolved Hide resolved
flash/vision/classification/data.py Outdated Show resolved Hide resolved
flash/vision/classification/data.py Show resolved Hide resolved
@tchaton tchaton merged commit 3b6a5de into master Apr 1, 2021
@tchaton tchaton deleted the data_pipeline_current_fn branch April 1, 2021 11:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants