(必有效)RuntimeError: An attempt has been made to start a new process before the current process(解决方案))

报此类错误:
(必有效)RuntimeError: An attempt has been made to start a new process before the current process(解决方案))_第1张图片
原因:多进程需要在main函数中运行,

解决方法1:
在这里插入图片描述

加main函数,在main中调用
(必有效)RuntimeError: An attempt has been made to start a new process before the current process(解决方案))_第2张图片

解决方法2:

num_workers改为0,单进程加载

你可能感兴趣的:(python)