PaddleNLP icon indicating copy to clipboard operation
PaddleNLP copied to clipboard

flask部署 多标签分类模型,单GPU单进程正常,多进程报错

Open shguan2018 opened this issue 2 years ago • 7 comments

flask部署 多标签分类模型,单GPU单进程正常,多进程报错

python3.8.12 paddlepaddle 2.2 paddlenlp 2.2.4

self.input_handles[0].copy_from_cpu(input_ids) File "/usr/local/python3/lib/python3.8/site-packages/paddle/fluid/inference/wrapper.py", line 35, in tensor_copy_from_cpu self.copy_from_cpu_bind(data) OSError: (External) CUDA error(3), initialization error. [Hint: 'cudaErrorInitializationError'. The API call failed because the CUDA driver and runtime could not be initialized. ] (at /paddle/paddle/fluid/platform/gpu_info.cc:284)

shguan2018 avatar Mar 21 '22 04:03 shguan2018

如果使用 CPU 模式,多进程也正常, 使用 GPU 模式,多进程就不正常

shguan2018 avatar Mar 21 '22 04:03 shguan2018

如果使用 CPU 模式,多进程也正常, 使用 GPU 模式,多进程就不正常

您好,能不能提供一下具体的部署代码?我们可以线下复现一下问题

wawltor avatar Mar 21 '22 06:03 wawltor

解决了吗 我也遇到了这个问题

nullgogo avatar Jul 25 '22 10:07 nullgogo

没有, 一直没有给我回信,后来我就用 paddle serving 部署了

shguan2018 avatar Jul 25 '22 10:07 shguan2018

https://stackoverflow.com/questions/22950047/cuda-initialization-error-after-fork cuda使用fork方式多进程有一些问题;可以试下改成PredictorPool的形式来预测,具体可以参考这个例子:https://github.com/PaddlePaddle/Paddle-Inference-Demo/blob/master/python/advanced/multi_thread/threads_demo.py

linjieccc avatar Jul 25 '22 11:07 linjieccc

https://stackoverflow.com/questions/22950047/cuda-initialization-error-after-fork cuda使用fork方式多进程有一些问题;可以试下改成PredictorPool的形式来预测,具体可以参考这个例子:https://github.com/PaddlePaddle/Paddle-Inference-Demo/blob/master/python/advanced/multi_thread/threads_demo.py

谢谢,我试试

shguan2018 avatar Jul 26 '22 02:07 shguan2018

This issue is stale because it has been open for 60 days with no activity. 当前issue 60天内无活动,被标记为stale。

github-actions[bot] avatar Jan 10 '23 08:01 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale. 当前issue 被标记为stale已有14天,即将关闭。

github-actions[bot] avatar Jan 25 '23 00:01 github-actions[bot]