-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Remove default parameter of ShufflerIterDataPipe #74370
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
[ghstack-poisoned]
CI Flow Status⚛️ CI FlowRuleset - Version:
|
🔗 Helpful links
💊 CI failures summary and remediationsAs of commit 5aa0cf1 (more details on the Dr. CI page):
1 failure not recognized by patterns:
This comment was automatically generated by Dr. CI (expand for details).Please report bugs/suggestions to the (internal) Dr. CI Users group. |
| return val | ||
|
|
||
| def set_shuffle_settings(self, shuffle=True): | ||
| def set_shuffle(self, shuffle=True): |
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.
Another suggestion I have for this would be enable_shuffle() or enable_shuffling(). But no strong opinion.
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.
I also thought about that, but I always feel strange doing something like enable_shuffle(False).
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.
If we want to have such syntax sugar, I prefer to have enable_shuffle() and disable_shuffle()
pmeier
left a comment
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.
| return val | ||
|
|
||
| def set_shuffle_settings(self, shuffle=True): | ||
| def set_shuffle(self, shuffle=True): |
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.
I also thought about that, but I always feel strange doing something like enable_shuffle(False).
torch/utils/data/graph_settings.py
Outdated
| for pipe in all_pipes: | ||
| if hasattr(pipe, 'set_shuffle_settings'): | ||
| pipe.set_shuffle_settings(shuffle) | ||
| if hasattr(pipe, 'set_shuffle'): |
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.
Shouldn't we do isinstance(pipe, Shuffler) here? Checking for a public attribute seems sketchy.
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.
Reasonable to me.
| self.datapipe = datapipe.unbatch(unbatch_level=unbatch_level) | ||
| self.buffer_size = buffer_size | ||
| self._shuffle_enabled = default | ||
| self._shuffle_enabled = True |
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.
Maybe just
| self._shuffle_enabled = True | |
| self._enabled = True |
?
Closes meta-pytorch/data#298. This PR: - removes the `default` parameter of `ShufflerIterDataPipe` - renames `set_shuffle_setting()` into `set_shuffle()` - let `set_shuffle()` return `self`. [ghstack-poisoned]
|
Thanks for the review Philip! Happy to apply the recommended changes, I'll just wait for Erjia's or Kevin's input.
I just added a minimal one now |
Closes meta-pytorch/data#298. This PR: - removes the `default` parameter of `ShufflerIterDataPipe` - renames `set_shuffle_setting()` into `set_shuffle()` - let `set_shuffle()` return `self`. [ghstack-poisoned]
Closes meta-pytorch/data#298. This PR: - removes the `default` parameter of `ShufflerIterDataPipe` - renames `set_shuffle_setting()` into `set_shuffle()` - let `set_shuffle()` return `self`. [ghstack-poisoned]
ejguan
left a comment
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 for fixing it. LGTM with the similar comment with Philip
| return val | ||
|
|
||
| def set_shuffle_settings(self, shuffle=True): | ||
| def set_shuffle(self, shuffle=True): |
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.
If we want to have such syntax sugar, I prefer to have enable_shuffle() and disable_shuffle()
torch/utils/data/graph_settings.py
Outdated
| for pipe in all_pipes: | ||
| if hasattr(pipe, 'set_shuffle_settings'): | ||
| pipe.set_shuffle_settings(shuffle) | ||
| if hasattr(pipe, 'set_shuffle'): |
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.
Reasonable to me.
Closes meta-pytorch/data#298. This PR: - removes the `default` parameter of `ShufflerIterDataPipe` - renames `set_shuffle_setting()` into `set_shuffle()` - let `set_shuffle()` return `self`. [ghstack-poisoned]
|
@NicolasHug has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Summary: Pull Request resolved: #74370 Closes meta-pytorch/data#298. This PR: - removes the `default` parameter of `ShufflerIterDataPipe` - renames `set_shuffle_setting()` into `set_shuffle()` - let `set_shuffle()` return `self`. Test Plan: Imported from OSS Reviewed By: george-qi Differential Revision: D35073666 Pulled By: NicolasHug fbshipit-source-id: 9847b037e70f44f36eaf4471f2c12fa8ec2ed73c
|
Hey @NicolasHug. |
Closes meta-pytorch/data#298. This PR:
defaultparameter ofShufflerIterDataPipeset_shuffle_setting()intoset_shuffle()set_shuffle()returnself.Stack from ghstack (oldest at bottom):
Differential Revision: D35073666