You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
pyhanlp多进程异常. 不能充分利用cpu,而且感觉 代码停止/"卡住"
Code to reproduce the issue
!pip3 install pyhanlp
from multiprocessing import Pool
from tqdm import tqdm
from pyhanlp import HanLP
print(HanLP.segment('hello'))
def test_process(tmp: int):
for i in range(10000):
HanLP.segment("商品和服务")
pool_ = Pool(2)
result = pool_.map(test_process, tqdm(range(10)))
pool_.close()
pool_.join()
# print(result)
print('END')
Describe the current behavior
同样的多进程代码,就单纯的分词代码改成其它分词工具是没有问题的 HanLP.segment -> jieba.cut
但是hanlp运行的时候cpu使用率在130%左右(机器是2颗 E5-2620 v4,每颗是8核16线程,内存剩余30G)
我不知道是真的卡住还是,速度慢.
Expected behavior
我希望能够多进程,高速运行hanlp分词
System information
OS Platform and Distribution (e.g., Linux Ubuntu 16.04):CentOS Linux release 7.6.1810 (Core)
Describe the bug
pyhanlp多进程异常. 不能充分利用cpu,而且感觉 代码停止/"卡住"
Code to reproduce the issue
Describe the current behavior
同样的多进程代码,就单纯的分词代码改成其它分词工具是没有问题的
HanLP.segment
->jieba.cut
但是hanlp运行的时候cpu使用率在130%左右(机器是2颗 E5-2620 v4,每颗是8核16线程,内存剩余30G)
我不知道是真的卡住还是,速度慢.
Expected behavior
我希望能够多进程,高速运行hanlp分词
System information
hanlp 2.1.0a36
hanlp-common 0.0.6
hanlp-downloader 0.0.20
hanlp-trie 0.0.2
pyhanlp 0.1.77
Other info / logs
这是使用
https://play.hanlp.ml/run/hanlp-zh
运行的结果
cpu使用率依旧是0,等了好久,一直在转.
图片链接
https://sm.ms/image/acSxlnBwpG49ehJ
代码改自#1625
在网上找到的可能相关的问题
https://bbs.hankcs.com/t/topic/2128
The text was updated successfully, but these errors were encountered: