pytorch 加载数据时报错:
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if __name__ == '__main__':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
在使用PyTorch加载数据时遇到RuntimeError,错误提示尝试在当前进程完成启动阶段前启动新进程。这通常由于未在主模块中使用正确的idiom(如if __name__ == '__main__':)或者没有使用fork来启动子进程。解决方案包括在main函数中添加'freeze_support()',或者将num_workers设置为0,改为单进程加载,但速度会减慢。
订阅专栏 解锁全文
2223

被折叠的 条评论
为什么被折叠?



