add support for instance checks on dataset wrappers#7239
Merged
pmeier merged 16 commits intopytorch:mainfrom Jul 31, 2023
Merged
add support for instance checks on dataset wrappers#7239pmeier merged 16 commits intopytorch:mainfrom
pmeier merged 16 commits intopytorch:mainfrom
Conversation
pmeier
commented
Feb 13, 2023
pmeier
commented
Feb 14, 2023
Dmatt18
approved these changes
Feb 23, 2023
NicolasHug
reviewed
Jul 13, 2023
Member
NicolasHug
left a comment
There was a problem hiding this comment.
Thanks Philip
This looks a bit insane but [for now] I'm not against it. It would help users integrate their code more smoothly, as we experienced in #7732
What else do we need to change to make it happen?
Contributor
Author
Nothing, this should work as is. One thing that I could try is to eliminate the |
NicolasHug
reviewed
Jul 17, 2023
NicolasHug
approved these changes
Jul 31, 2023
Member
NicolasHug
left a comment
There was a problem hiding this comment.
Thanks Philip.
Do we have a lot of datasets that store extra attributes
| wrapped_dataset = wrap_dataset_for_transforms_v2(dataset, target_keys=target_keys) | ||
| wrapped_sample = wrapped_dataset[0] | ||
| assert isinstance(wrapped_dataset, self.DATASET_CLASS) | ||
| assert len(wrapped_dataset) == info["num_examples"] |
Member
There was a problem hiding this comment.
is that related or is it a drive-by?
Contributor
Author
There was a problem hiding this comment.
L587 is needed to enforce the isinstance check works properly. L588 is a driveby.
facebook-github-bot
pushed a commit
that referenced
this pull request
Aug 25, 2023
Reviewed By: matteobettini Differential Revision: D48642290 fbshipit-source-id: d44279d2024dfb0387f0d70d84d6c8d128b33394
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Per title following an offline discussion with @NicolasHug.
cc @vfdev-5 @bjuncek