且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Pytorch 问题:当 num_workers > 时,我的 jupyter 卡住了0

更新时间:2023-02-07 10:50:05

num_workers大于0时,PyTorch使用多个进程进行数据加载.

When num_workers is greater than 0, PyTorch uses multiple processes for data loading.

Jupyter 笔记本在多处理方面存在已知问题.

Jupyter notebooks have known issues with multiprocessing.

解决此问题的一种方法是不使用 Jupyter notebook - 只需编写一个普通的 .py 文件并通过命令行运行它.

One way to resolve this is not to use Jupyter notebooks - just write a normal .py file and run it via command-line.

或者尝试使用这里的建议:Jupyter notebook 永远不会完成使用多处理 (Python 3) 进行处理.

Or try use what's suggested here: Jupyter notebook never finishes processing using multiprocessing (Python 3).