-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Update worker_init_fn test for pytorch 1.9 nightly #7441
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
Codecov Report
@@ Coverage Diff @@
## master #7441 +/- ##
======================================
- Coverage 92% 92% -0%
======================================
Files 199 199
Lines 12987 12987
======================================
- Hits 11925 11909 -16
- Misses 1062 1078 +16 |
ananthsub
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.
Nice that your initial commit was a reference for the PyTorch fix!
| pass | ||
|
|
||
|
|
||
| @RunIf(max_torch="1.8.9") |
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.
Shall we rather have an arg that spec max wersion as < instead of <=
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.
Or set it just as 1.8 as max without minor numbers?
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.
< would be more practical I guess but it would not be obvious from the name if < or <=.
Maybe a different approach would be to have torch_gt, torch_ge, torch_lt, torch_le but that would be more argumens ...
not sure
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 may say that more practical would be setting level
- max 1.8.1 will keep 1.8.0, 1.8.1 and ignore 1.8.2 and above
- max 1.8 will keep 1.8.0, 1.8.1, 1.8.x and ignore 1.9.x and above
- max 1 will keep 1.8.0, 1.x and ignore 2.x and above
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.
+1 for the gt, ge, lt and le. Another option would be to have something like `torch_req='<1.9``. But this would involve more parsing logic.
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.
@awaelchli should the pl worker init function when used with PT 1.9 also be a no-op? given that pytorch now sets the seed correctly?
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.
for numpy yes, we don't need to worry about it in 1.9+.
But another part of the pl_worker_init_fn is that it derives not only a unique seed for each worker but it makes it also unique across all distributed processes (we do that by incorporating the global_rank into the seed sequence). I don't think 1.9 does that.
(cherry picked from commit 1af42d7)
(cherry picked from commit 1af42d7)
(cherry picked from commit 1af42d7)
What does this PR do?
Fixes #7396
We can ignore a test for pytorch 1.9 since it successfully implements the seeding for numpy in DataLoader workers.
Here is where it got implemented:
pytorch/pytorch@3b977a0
Thanks @ananthsub for pointing me to the commit.
cc @Borda
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:
Did you have fun?
Make sure you had fun coding 🙃