更新时间: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).