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

more return types #195

Closed
wants to merge 11 commits into from
Closed

more return types #195

wants to merge 11 commits into from

Conversation

aniketmaurya
Copy link
Contributor

@aniketmaurya aniketmaurya commented Mar 26, 2021

What does this PR do?

Fixes #191

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 🙃

@aniketmaurya aniketmaurya changed the title Issue 191 more return types more return types Mar 26, 2021
@aniketmaurya aniketmaurya marked this pull request as draft March 26, 2021 15:57
@codecov
Copy link

codecov bot commented Mar 26, 2021

Codecov Report

Merging #195 (0109236) into master (3b4c6b6) will increase coverage by 0.06%.
The diff coverage is 91.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #195      +/-   ##
==========================================
+ Coverage   76.52%   76.58%   +0.06%     
==========================================
  Files          56       56              
  Lines        2334     2345      +11     
==========================================
+ Hits         1786     1796      +10     
- Misses        548      549       +1     
Flag Coverage Δ
unittests 76.58% <91.66%> (+0.06%) ⬆️

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

Impacted Files Coverage Δ
flash/core/model.py 95.28% <91.66%> (-0.51%) ⬇️

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 3b4c6b6...0109236. Read the comment docs.

@aniketmaurya aniketmaurya marked this pull request as ready for review March 27, 2021 08:36
@Borda Borda added the enhancement New feature or request label Mar 28, 2021
Comment on lines +130 to +131
return_type: str = None,
labels: Optional[List[str]] = None,
Copy link
Member

Choose a reason for hiding this comment

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

is it updated also in docs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Borda are docs created automatically with help of docstrings?

Copy link
Member

Choose a reason for hiding this comment

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

yes, types and default are also in docs

@Borda
Copy link
Member

Borda commented Apr 6, 2021

@aniketmaurya mind check collision :]

@aniketmaurya
Copy link
Contributor Author

Sure @Borda

@carmocca
Copy link
Contributor

carmocca commented Apr 6, 2021

Note that this should be handled inside a Postprocess, not in the predict_step

@aniketmaurya
Copy link
Contributor Author

Note that this should be handled inside a Postprocess, not in the predict_step

@carmocca are you suggesting to put postprocess in the data_pipeline? Or pass the arguments in predict func and a separate postprocess func should take care of it? Because I see that data_pipeline has to be passed by user as argument and it will not be convenient for users to create data_pipeline for printing classes/raw probs.

@carmocca
Copy link
Contributor

carmocca commented Apr 7, 2021

DataPipeline was completely revamped recently. It now includes Preprocess and Postprocess objects.

These return conversions are now expected to be encapsulated by the postprocess part. What is your use case exactly?

For example:

https://github.com/PyTorchLightning/lightning-flash/blob/master/flash/core/classification.py

cc: @tchaton

@@ -55,6 +56,11 @@ class Task(LightningModule):
learning_rate: Learning rate to use for training, defaults to `5e-5`
"""

class Return(Enum):
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the idea, but the PR is outdate. Do you mind merging with master. Also, this logic should be handled by the postprocess object.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hi @tchaton , as @carmocca pointed out that DataPipeline is completely revamped and codes were dependent on prev flow. I will create the logic again with postprocess object and update the PR.

@ethanwharris
Copy link
Collaborator

Hi @aniketmaurya, great work on this PR 😃 I've now added multiple return types in #229 (with some inspiration from your work) so closing this.

Please feel free to provide your thoughts on #229

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support more return types in predict
5 participants