jieba icon indicating copy to clipboard operation
jieba copied to clipboard

paddle 模式下词性标注,并发时可能会出错

Open hscspring opened this issue 4 years ago • 7 comments

错误代码在 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

hscspring avatar Mar 11 '20 08:03 hscspring

您好,不知是否方便share一下环境,我们追一下。

xyzhou-puck avatar Mar 11 '20 10:03 xyzhou-puck

@xyzhou-puck 您客气了。是我的问题,应该把相关信息放上来的。已 update。

hscspring avatar Mar 13 '20 04:03 hscspring

@xyzhou-puck hello,请问这个问题如何了?

hscspring avatar Jun 18 '20 11:06 hscspring

Hi,抱歉,我已经离开paddlepaddle了,这个问题已经转交给我之前的同事,谢谢你对paddle的支持。

xyzhou-puck avatar Jun 18 '20 11:06 xyzhou-puck

@xyzhou-puck 哈,祝好~

hscspring avatar Jun 19 '20 01:06 hscspring

我也遇到了这个问题 @hscspring 大佬,有查到是什么原因吗

luopeixiang avatar Jun 16 '22 07:06 luopeixiang

邮件已收到~

manother avatar Jun 16 '22 07:06 manother