Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for instance checks on dataset wrappers #7239

Merged
merged 16 commits into from
Jul 31, 2023

Conversation

pmeier
Copy link
Contributor

@pmeier pmeier commented Feb 13, 2023

Per title following an offline discussion with @NicolasHug.

cc @vfdev-5 @bjuncek

Copy link
Member

@NicolasHug NicolasHug left a comment

Choose a reason for hiding this comment

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

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?

torchvision/datapoints/_dataset_wrapper.py Outdated Show resolved Hide resolved
@pmeier
Copy link
Contributor Author

pmeier commented Jul 17, 2023

What else do we need to change to make it happen?

Nothing, this should work as is. One thing that I could try is to eliminate the VisionDatasetDatapointWrapper class.

@pytorch-bot
Copy link

pytorch-bot bot commented Jul 17, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/7239

Note: Links to docs will display an error until the docs builds have been completed.

❌ 32 New Failures

As of commit 5603b38:

NEW FAILURES - The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pmeier pmeier changed the title [PoC] add support for instance checks on dataset wrappers add support for instance checks on dataset wrappers Jul 31, 2023
@pmeier pmeier requested a review from NicolasHug July 31, 2023 19:42
@pmeier pmeier marked this pull request as ready for review July 31, 2023 19:42
Copy link
Member

@NicolasHug NicolasHug left a comment

Choose a reason for hiding this comment

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

Thanks Philip.

Do we have a lot of datasets that store extra attributes

@@ -584,8 +584,10 @@ def test_transforms_v2_wrapper(self, config):
continue

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"]
Copy link
Member

Choose a reason for hiding this comment

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

is that related or is it a drive-by?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

L587 is needed to enforce the isinstance check works properly. L588 is a driveby.

torchvision/datapoints/_dataset_wrapper.py Outdated Show resolved Hide resolved
@pmeier pmeier merged commit bdf1622 into pytorch:main Jul 31, 2023
10 of 26 checks passed
@pmeier pmeier deleted the isinstance-dataset-wrapper branch July 31, 2023 21:36
facebook-github-bot pushed a commit that referenced this pull request Aug 25, 2023
Reviewed By: matteobettini

Differential Revision: D48642290

fbshipit-source-id: d44279d2024dfb0387f0d70d84d6c8d128b33394
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants