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

[BUG] - torchvision_tutorial.py fails with a RuntimeError #2843

Closed
svekars opened this issue Apr 19, 2024 · 4 comments · Fixed by #2909
Closed

[BUG] - torchvision_tutorial.py fails with a RuntimeError #2843

svekars opened this issue Apr 19, 2024 · 4 comments · Fixed by #2909

Comments

@svekars
Copy link
Contributor

svekars commented Apr 19, 2024

Add Link

https://pytorch.org/tutorials/intermediate/torchvision_tutorial.html

Describe the bug

Fails in CI and locally on MacOS with:

disable due to RuntimeError: DataLoader worker (pid(s) 20092) exited unexpectedly

The tutorial was disabled in: #2842 - can be enabled after the issue is resolved.

Describe your environment

  • macOS and CI
  • Pytorch 2.3

cc @datumbox @nairbv @fmassa @NicolasHug @YosuaMichael @sekyondaMeta @kit1980

@alperenunlu
Copy link
Contributor

/assigntome

@alperenunlu
Copy link
Contributor

@svekars Should I just describe the bug or also solve it.

@svekars
Copy link
Contributor Author

svekars commented Jun 6, 2024

@alperenunlu the task here is to solve the issue and enable the tutorial.

@alperenunlu
Copy link
Contributor

So the main problem is torch.utils.data uses different behavior on different platforms

In MacOS and Windows it uses spawn() on Unix it uses fork() for multiprocessing.

So if we were running a script we should wrap our main script in a if __name__ == "__main__": that will solve the problem but in Jupyter notebooks this also doesn't work so if we want to create a solution for both notebooks and script the best thing come to my mind is checking the platform and setting the num_workers according to that.

@NicolasHug

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

Successfully merging a pull request may close this issue.

3 participants