问题描述:报错
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
is not going to be frozen to produce an executable.
ForkingPickler(file, protocol).dump(obj)
BrokenPipeError: [Errno 32] Broken pipe
解决方法(三选一):
- 使用cmd / Anaconda Prompt运行python文件
- 将进程数更改为0
def get_dataloader_workers():
return 0
- 将需要运行的内容放入
if __name__=='__main__':
(除定义函数/类之外的内容)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)