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

train in ipynb with accelerator="auto" failed #12774

Closed
Borda opened this issue Apr 15, 2022 · 3 comments
Closed

train in ipynb with accelerator="auto" failed #12774

Borda opened this issue Apr 15, 2022 · 3 comments
Assignees
Milestone

Comments

@Borda
Copy link
Member

Borda commented Apr 15, 2022

🐛 Bug

Is expected to run auto mode of PL Trainer in ipython notebook on a machine that has two GPUs?

To Reproduce

Run a Trainer with

accelerator="auto"
devices="auto"

In a Jupyter notebook cell.

MisconfigurationException: `Trainer(strategy='ddp_spawn')` or `Trainer(accelerator='ddp_spawn')` is not compatible with an interactive environment. Run your code as a script, or choose one of the compatible strategies: Trainer(strategy=None|dp|tpu_spawn). In case you are spawning processes yourself, make sure to include the Trainer creation inside the worker function.

Expected behavior

just take the best supported and run, no crashing

Environment

  • PyTorch Lightning Version (e.g., 1.5.0):
  • PyTorch Version (e.g., 1.10):
  • Python version (e.g., 3.9):
  • OS (e.g., Linux):
  • CUDA/cuDNN version:
  • GPU models and configuration:
  • How you installed PyTorch (conda, pip, source):
  • If compiling from source, the output of torch.__config__.show():
  • Any other relevant information:

Additional context

cc @justusschock @kaushikb11 @awaelchli @ninginthecloud @akihironitta @rohitgr7

@Borda Borda added the needs triage Waiting to be triaged by maintainers label Apr 15, 2022
@awaelchli
Copy link
Contributor

For accelerator="auto", devices="auto" we didn't consider that in Jupyter notebooks, we need a different default for the strategy. So in this sense, strategy should also be selected automatically. For multi-gpu in notebooks, only strategy="dp" works here. So if we want to support that, we would need to add a condition to the AcceleratorConnector.

@awaelchli awaelchli added trainer: connector accelerator strategy bug Something isn't working and removed needs triage Waiting to be triaged by maintainers labels Apr 15, 2022
@awaelchli awaelchli added this to the 1.6.x milestone Apr 15, 2022
@nicocheh
Copy link

Hi @awaelchli , i used DDPSpawnStrategy(find_unused_parameters=False) with accelerator="gpu" and some weeks ago it worked in a jupyter notebook using multiple GPUs. Did something changed that is not working any more?

@awaelchli
Copy link
Contributor

This is fixed now with #13405. accelerator="auto", devices="auto" will select the right strategy in the jupyter notebook.
@nicocheh For setting find_unused_parameters_false, we added the option strategy="ddp_notebook_find_unused_parameters_false".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants