question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Suggestion: remove the `default` parameter of `ShufflerIterDataPipe`

See original GitHub issue

IIUC, the default parameter of ShufflerIterDataPipe is intended to allow users to disable shuffling and potentially re-enable it manually later.

This seems to be supported already through the set_shuffle_setting(False) method, namely:

dp = ShufflerIterDataPipe(dp, default=False)

# is equivalent to

dp = ShufflerIterDataPipe(dp)
dp.set_shuffle_setting(False)

So I would suggest to remove the default parameter so as to simplify the interface of ShufflerIterDataPipe, as its use-case is already natively supported in a simple way. Going further, perhaps we could also let set_shuffle_setting return self, so that one can just do the following one-liner:

dp = ShufflerIterDataPipe(dp).set_shuffle_setting(False)

Happy to submit a PR for this if you’re OK with the proposal.

CC @pmeier with whom I just discussed this offline.

EDIT: another suggestion from Philip:

Maybe also rename to set_shuffle since the settings part sounds like I’m able to set multiple things

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ejguancommented, Mar 16, 2022

Sounds great to me. Eliminating this argument would also help us unify the API with TorchArrow’s shuffle.

Maybe also rename to set_shuffle since the settings part sounds like I’m able to set multiple things

Great.

And, for DataLoader, we still need to modify the default argument to None to prevent overriding if users don’t provide such shuffle argument.

0reactions
pmeiercommented, Mar 28, 2022

Closed in pytorch/pytorch#74370.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ShufflerIterDataPipe.set_shuffle_settings(True) gets ... - GitHub
I think this is intentional design based on Philips's requirement that shuffle would be a no-op by default. We needed a way to...
Read more >
C#: Method overrides should not change parameter defaults
Remove the default parameter value to match the signature of overridden method. * Add the default parameter value defined in the overridden method....
Read more >
c# method with default parameter value does not generate ...
In the case of default parameters, the actual call site is re-written to use the default value. This means an overload isn't generated...
Read more >
Default parameters - JavaScript - MDN Web Docs
Default function parameters allow named parameters to be initialized with default values if no value or undefined is passed.
Read more >
Python Default Parameter Value - W3Schools
The following example shows how to use a default parameter value. If we call the function without argument, it uses the default value:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found