因项目需要在notebook服务python环境中拉取模型数据,在执行相关的python语句时存在如下报错:

joblib.externals.loky.process_executor.TerminatedWorkerError: A worker process managed by the executor was unexpectedly terminated. This could be caused by a segmentation fault while calling the function or by an excessive memory usage causing the Operating System to kill the worker.

这个错误是由于内存不足,导致操作系统杀死工作进程引起。

解决办法

n_jobs参数控制joblib管理的并行度数量(进程或线程取决于joblib后端)
  • 减少数据集大小或使用更小的模型来减少内存使用量。
  • 增加可用运行内存来缓解。
  • 通过调整joblib中n_jobs参数,尝试将n_jobs设置为1或原有配置数-1。

参考文档:
https://stackoverflow.com/questions/71763118/what-is-causing-my-random-joblib-externals-loky-process-executor-terminatedwor

END

本文标题:python3.8执行报错joblib.externals.loky.process_executor.TerminatedWorkerError

本文作者:宇宙最帅的男人

本文链接:https://lolicp.com/python/202319572.html

版权声明:转载或者引用本文内容请注明来源及原作者,本文著作权归作者 (宇宙最帅的男人) 所有。

除非另有说明,本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议

最后修改:2023 年 05 月 19 日
如果觉得我的文章对你有用,请随意赞赏