当前位置: 首页 > 工具软件 > rein > 使用案例 >

uWSGI +Flask+torch Cannot re-initialize CUDA in forked subprocess

薄欣怿
2023-12-01

用uWSGI +Flask多进程多线程部署你的深度学习应用时,访问会报这样的错

"Cannot re-initialize CUDA in forked subprocess. To use CUDA with "
RuntimeError: Cannot re-initialize CUDA in forked subprocess. To use CUDA with multiprocessing, you must use the 'spawn' start method

查了半天,终于查到怎么使用spawn方法而不是fork

在uWSGI的配置文件中,添加 lazy=true 即可

 类似资料: