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

prepare_data called multiple times per node for slurm and elastic training #1878

Closed
tullie opened this issue May 18, 2020 · 1 comment · Fixed by #2166
Closed

prepare_data called multiple times per node for slurm and elastic training #1878

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

Comments

@tullie
Copy link
Contributor

tullie commented May 18, 2020

🐛 Bug

Slurm and elastic training create the training processes per node outside of the lightning context. This means that when the fit function calls prepare_data, the assumption that it's only being called on proc 0 is broken and it gets called for each process.

This is an issue computational reasons (e.g. downloading a whole dataset) and for training stability if the data preparation process isn't deterministic.

See calling code here:
https://github.com/PyTorchLightning/pytorch-lightning/blob/7c7e50ca4702a5b35bc1b80d44bca7606552093a/pytorch_lightning/trainer/trainer.py#L825

To Reproduce

Steps to reproduce the behavior:

  1. Add print statements to prepare_data
  2. Train a lightning model with either slurm or elastic training
  3. See that it's being called multiple times.

Expected behavior

Expected prepare_data to only be called once per node.

@tullie tullie added bug Something isn't working help wanted Open to be worked on labels May 18, 2020
@edenlightning
Copy link
Contributor

@Borda any idea how to fix?

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
2 participants