jieba
jieba copied to clipboard
paddle 模式下词性标注,并发时可能会出错
错误代码在 predict.py
:
def get_result(str1):
feed_data=dataset.get_vars(str1)
a = numpy.array(feed_data).astype(numpy.int64)
a=a.reshape(-1,1)
c = fluid.create_lod_tensor(a, [[a.shape[0]]], place)
words, crf_decode = exe.run(
infer_program,
fetch_list=[infer_ret['words'], infer_ret['crf_decode']],
feed={"words":c, },
return_numpy=False,
use_program_cache=True)
results=[]
results += utils.parse_result(words, crf_decode, dataset)
return results
原因是 exe.run
没有能执行成功,结果为空 list,words, crf_decode
绑定空 list 导致程序错误。
另外并发时还有个问题就是 token 可能会切的非常长。
测试环境: MacOS Mojave 10.14.6 2.7 GHz Inter Core i5 8G 1867 MHz DDR3
gRPC Server Python 3.7.4
测试工具: ghz · Simple gRPC benchmarking and load testing tool
另外,我弄了个简单的复现,不知道有没有帮助: https://github.com/hscspring/pseg_paddle/tree/master/stress_test
您好,不知是否方便share一下环境,我们追一下。
@xyzhou-puck 您客气了。是我的问题,应该把相关信息放上来的。已 update。
@xyzhou-puck hello,请问这个问题如何了?
Hi,抱歉,我已经离开paddlepaddle了,这个问题已经转交给我之前的同事,谢谢你对paddle的支持。
@xyzhou-puck 哈,祝好~
我也遇到了这个问题 @hscspring 大佬,有查到是什么原因吗
邮件已收到~