怎么并行多gpu使用hannlp的命名实体模型啊 已经尝试很久了 一直都没有成功
我这边在写服务的时候尝试,比如一个fastapi app里有:
model = hanlp.load(…)
然后在启动应用的时候,uvicorn -w设置多worker,似乎是可以自动分配到多worker上的,你可以试试。
但是最近也在受苦
服务现在重构加上了RQ的任务队列,启动的时候就一直是
RuntimeError:Cannot re-initialize CUDA in forked subprocessTo use CUDA with multiprocessing, you must use the 'spawn' start method
哪怕入口设置了mp.set_start_method(“spawn”, force=True)也没有效果,还在想办法