BERT-BiLSTM-CRF-NER icon indicating copy to clipboard operation
BERT-BiLSTM-CRF-NER copied to clipboard

推理速度

Open caseware66 opened this issue 5 years ago • 16 comments

使用 1个cpu 12核心,一个1000个字的文章,推理速度在1000ms,这个速度正常吗,GPU,大概是100毫秒。一般什么速度比较正常?

caseware66 avatar Jan 07 '20 09:01 caseware66

还有什么可以优化的方案吗?

caseware66 avatar Jan 07 '20 09:01 caseware66

公司现在要进行实时预测,一般速度多少合适?

caseware66 avatar Jan 07 '20 09:01 caseware66

实时要10ms左右吧,控制在30ms/example. 想加速的话,明天争取写个教程

macanv avatar Jan 11 '20 12:01 macanv

好的,多谢您,请问您的加速是要使用gpu的基础上是吧。

---原始邮件--- 发件人: "MaCan"<[email protected]> 发送时间: 2020年1月11日(周六) 晚上8:28 收件人: "macanv/BERT-BiLSTM-CRF-NER"<[email protected]>; 抄送: "caseware66"<[email protected]>;"Author"<[email protected]>; 主题: Re: [macanv/BERT-BiLSTM-CRF-NER] 推理速度 (#293)

实时要10ms左右吧,控制在30ms/example. 想加速的话,明天争取写个教程

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

caseware66 avatar Jan 11 '20 12:01 caseware66

期待您明天的教程,谢谢!

---原始邮件--- 发件人: "MaCan"<[email protected]> 发送时间: 2020年1月11日(周六) 晚上8:28 收件人: "macanv/BERT-BiLSTM-CRF-NER"<[email protected]>; 抄送: "caseware66"<[email protected]>;"Author"<[email protected]>; 主题: Re: [macanv/BERT-BiLSTM-CRF-NER] 推理速度 (#293)

实时要10ms左右吧,控制在30ms/example. 想加速的话,明天争取写个教程

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

caseware66 avatar Jan 11 '20 13:01 caseware66

您好:

     您的推理加速的教程要是写好了,可以发给我学习一下吗?

 

------------------ 原始邮件 ------------------ 发件人: "MaCan"<[email protected]>; 发送时间: 2020年1月11日(星期六) 晚上8:27 收件人: "macanv/BERT-BiLSTM-CRF-NER"<[email protected]>; 抄送: "泡沫"<[email protected]>;"Author"<[email protected]>; 主题: Re: [macanv/BERT-BiLSTM-CRF-NER] 推理速度 (#293)

实时要10ms左右吧,控制在30ms/example. 想加速的话,明天争取写个教程

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

caseware66 avatar Jan 13 '20 04:01 caseware66

加班去了,没有写,不过和会争取快点写好。

macanv avatar Jan 14 '20 12:01 macanv

谢谢!

---原始邮件--- 发件人: "MaCan"<[email protected]> 发送时间: 2020年1月14日(周二) 晚上8:07 收件人: "macanv/BERT-BiLSTM-CRF-NER"<[email protected]>; 抄送: "caseware66"<[email protected]>;"Author"<[email protected]>; 主题: Re: [macanv/BERT-BiLSTM-CRF-NER] 推理速度 (#293)

加班去了,没有写,不过和会争取快点写好。

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

caseware66 avatar Jan 14 '20 12:01 caseware66

您的方法中是否albert替换bert,我目前在研究这个。

---原始邮件--- 发件人: "MaCan"<[email protected]> 发送时间: 2020年1月14日(周二) 晚上8:07 收件人: "macanv/BERT-BiLSTM-CRF-NER"<[email protected]>; 抄送: "caseware66"<[email protected]>;"Author"<[email protected]>; 主题: Re: [macanv/BERT-BiLSTM-CRF-NER] 推理速度 (#293)

加班去了,没有写,不过和会争取快点写好。

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

caseware66 avatar Jan 14 '20 12:01 caseware66

前不久刚测试过,albert_tiny推理速度大概有6、7倍左右的提升,但识别效果比bert_base要差不少,albert_base识别效果差一点,推理速度比bert_base还稍微慢一点。推理速度提升目前试出来的方法大概有使用GPU、减小max_seq_length、加大batch_size。期待作者大佬的教程。

yinyao avatar Feb 05 '20 14:02 yinyao

albert_base的推理速度要比bert_base快吧。

---原始邮件--- 发件人: "yinyao"<[email protected]> 发送时间: 2020年2月5日(周三) 晚上10:24 收件人: "macanv/BERT-BiLSTM-CRF-NER"<[email protected]>; 抄送: "caseware66"<[email protected]>;"Author"<[email protected]>; 主题: Re: [macanv/BERT-BiLSTM-CRF-NER] 推理速度 (#293)

前不久刚测试过,albert_tiny推理速度大概有6、7倍左右的提升,但识别效果比bert_base要差不少,albert_base识别效果差一点,推理速度比bert_base还稍微慢一点。推理速度提升目前试出来的方法大概有使用GPU、减小max_seq_length、加大batch_size。期待作者大佬的教程。

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

caseware66 avatar Feb 05 '20 14:02 caseware66

我测的albert_base训练比bert_base快很多,但推理速度并没有提升

yinyao avatar Feb 05 '20 14:02 yinyao

@caseware66 https://blog.csdn.net/macanv/article/details/104194678

macanv avatar Feb 21 '20 14:02 macanv

收到!

---原始邮件--- 发件人: "MaCan"<[email protected]> 发送时间: 2020年2月21日(周五) 晚上10:53 收件人: "macanv/BERT-BiLSTM-CRF-NER"<[email protected]>; 抄送: "Mention"<[email protected]>;"caseware66"<[email protected]>; 主题: Re: [macanv/BERT-BiLSTM-CRF-NER] 推理速度 (#293)

@caseware66 https://blog.csdn.net/macanv/article/details/104194678

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

caseware66 avatar Feb 21 '20 14:02 caseware66

您好:        我在参考您的bert转化为albert的时候,出现了一个错误,麻烦您给看一下:

ValueError: Shape of variable bert/embeddings/LayerNorm/beta:0 ((128,)) doesn't match with shape of tensor bert/embeddings/LayerNorm/beta ([312]) from checkpoint reader.

------------------ 原始邮件 ------------------ 发件人: "MaCan"<[email protected]>; 发送时间: 2020年2月21日(星期五) 晚上10:53 收件人: "macanv/BERT-BiLSTM-CRF-NER"<[email protected]>; 抄送: "泡沫"<[email protected]>;"Mention"<[email protected]>; 主题: Re: [macanv/BERT-BiLSTM-CRF-NER] 推理速度 (#293)

@caseware66 https://blog.csdn.net/macanv/article/details/104194678

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

caseware66 avatar Mar 11 '20 10:03 caseware66

作者服务端的实现方式是用bert-as-service+flask的搭建的,但是我用的过程中发现经常会报一些错误,可以采用这个方法,会稳定很多https://www.jianshu.com/p/383129b2bf7f

lvjianjin avatar Mar 30 '20 08:03 lvjianjin