-
Notifications
You must be signed in to change notification settings - Fork 7.1k
add support for instance checks on dataset wrappers #7239
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
Conversation
There was a problem hiding this 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?
Nothing, this should work as is. One thing that I could try is to eliminate the |
There was a problem hiding this 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"] |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Reviewed By: matteobettini Differential Revision: D48642290 fbshipit-source-id: d44279d2024dfb0387f0d70d84d6c8d128b33394
Per title following an offline discussion with @NicolasHug.
cc @vfdev-5 @bjuncek