-
-
Notifications
You must be signed in to change notification settings - Fork 439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] bert直接接bi-lstm+crf之后预测很慢,一条预测要耗时260ms,请问能优化速度吗 #78
Comments
BERT 速度就这么慢,暂时没有办法优化。参考:http://eliyar.biz/nlp_chinese_bert_ner/ |
谢谢owener,我之前看过这个博客,但是因为我以为这个是CPU跑起来的预测模型,MacBook Pro 13, 2 GHz Intel Core i5, 8G RAM,所以我感觉是不是GPU有提升空间,并且我在别的博客里面看到有10ms的预测速度,但是我个人不是很相信(受限于个人自身知识面),但不知道您有没有了解过这个10ms,参考https://github.com/macanv/BERT-BiLSTM-CRF-NER/issues/40 |
GPU 上可能会比较快,我这两天找时间测试一下。还有我们也在规划从 keras 转到 tf.keras #77 ,到时候保存模型,再用 serving 方式去预测,应该还能有所提升。 |
太好了,谢谢您的回复:smiley:持续关注 |
我也是predict特别慢啊,更加夸张的是1个sample需要1.3秒。(我的sequence length = 512) |
@Rainman242 predit 方法可以传数组,就会 batch predict。慢目前没有很好地解决办法。 |
Last week I tested a classifier with Bert as the embedding layer. The
prediction time was also very slow. I assumed that was because the
calculating work is heavy during the Bert section for CPUs.
I will be appreciated if anyone could test relative task with Bert on GPUs
and share his/her findings.
…On Sun, 5 May 2019 at 11:59, Eliyar Eziz ***@***.***> wrote:
@Rainman242 <https://github.com/Rainman242> predit 方法可以传数组,就会 batch
predict。慢目前没有很好地解决办法。
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#78 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGRFKUFQ33U6LBEJFBJGPDPTZLQJANCNFSM4HILVHMQ>
.
|
可以在 tf.keras 版本尝试看看,但是 crf 本身也会比较慢,如果对性能要求比较高,可以尝试不用 crf 层。 |
@alexwwang , @wayneowen7 , @Rainman242 ,https://github.com/SunYanCN/BERT-chinese-text-classification-and-deployment, This project may be helpful |
@wayneowen7 @Rainman242 试试 tf.keras 分支的 tf-serving 部署。 BiLSTM_CRF_Model, 100 sequence_length 测试结果如下: 1080Ti-GPU 50ms |
我们能在cpu上优化到30ms,不过做了大量工作。 |
@qiuwei 可以分享一下优化经验么? |
@qiuwei 望大佬分享一下经验~ |
titan xp的GPU,应该能排除机器问题,,,想问问有没有解决办法
The text was updated successfully, but these errors were encountered: