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

Utility rank_zero_only doesn't properly handle environment variable LOCAL_RANK #2641

Closed
ananthsub opened this issue Jul 18, 2020 · 1 comment · Fixed by #2640
Closed

Utility rank_zero_only doesn't properly handle environment variable LOCAL_RANK #2641

ananthsub opened this issue Jul 18, 2020 · 1 comment · Fixed by #2640
Labels
bug Something isn't working help wanted Open to be worked on

Comments

@ananthsub
Copy link
Contributor

🐛 Bug

The LOCAL_RANK environment variable can be a string. This causes checks in the rank_zero_only decorator to fail here: https://github.com/PyTorchLightning/pytorch-lightning/blob/master/pytorch_lightning/utilities/distributed.py#L11

Expected behavior

We should cast LOCAL_RANK to an int both in the rank_zero_only check as well as in the trainer here: https://github.com/PyTorchLightning/pytorch-lightning/blob/master/pytorch_lightning/trainer/trainer.py#L385

Then the decorator works as we expected

@ananthsub ananthsub added bug Something isn't working help wanted Open to be worked on labels Jul 18, 2020
@ananthsub ananthsub changed the title Utility rank_zero_only doesn't handle environment variable LOCAL_RANK Utility rank_zero_only doesn't properly handle environment variable LOCAL_RANK Jul 18, 2020
@github-actions
Copy link
Contributor

Hi! thanks for your contribution!, great first issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Open to be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant