Comments (13)
BERT 速度就这么慢,暂时没有办法优化。参考:http://eliyar.biz/nlp_chinese_bert_ner/
from kashgari.
谢谢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
from kashgari.
GPU 上可能会比较快,我这两天找时间测试一下。还有我们也在规划从 keras 转到 tf.keras #77 ,到时候保存模型,再用 serving 方式去预测,应该还能有所提升。
from kashgari.
太好了,谢谢您的回复:smiley:持续关注
from kashgari.
我也是predict特别慢啊,更加夸张的是1个sample需要1.3秒。(我的sequence length = 512)
其实我fit一个batch=32也只要4秒左右。
请问作者大大,有没有batch predict之类的方法可以调用?
from kashgari.
@Rainman242 predit 方法可以传数组,就会 batch predict。慢目前没有很好地解决办法。
from kashgari.
from kashgari.
可以在 tf.keras 版本尝试看看,但是 crf 本身也会比较慢,如果对性能要求比较高,可以尝试不用 crf 层。
from kashgari.
@alexwwang , @wayneowen7 , @Rainman242 ,https://github.com/SunYanCN/BERT-chinese-text-classification-and-deployment, This project may be helpful
from kashgari.
@wayneowen7 @Rainman242 试试 tf.keras 分支的 tf-serving 部署。
BiLSTM_CRF_Model, 100 sequence_length 测试结果如下:
1080Ti-GPU 50ms
CPU 200ms
from kashgari.
谢谢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
我们能在cpu上优化到30ms,不过做了大量工作。
from kashgari.
@qiuwei 可以分享一下优化经验么?
from kashgari.
@qiuwei 望大佬分享一下经验~
from kashgari.
Related Issues (20)
- ner任务 tf_serving 调用问题
- [Question] 请问这个错误如何解决? HOT 2
- [Question] Can i adjust the learning rate of CRF? HOT 1
- [Question] labeling模型进行推理时随次数的增加而进程占用的内存逐渐增多,是否存在内存内存泄漏现象? HOT 2
- [Question] How to adjust learning rate when I use Bi-LSTM model on classification task? HOT 2
- [Question] 关于继续学习添加新的实体 HOT 2
- 使用albert做嵌入的时候报错 HOT 1
- 导入BERTEmbedding失败 HOT 2
- [Question] 文本分类中的CNN开头的模型accuracy不管换数据集还是调参数都只有0.2 HOT 1
- [Question] 使用keras导入RAdam时报错 HOT 1
- [Question] https://eliyar.biz/ can't open HOT 2
- ner: cnn+lstm and bigru mod ,The code is the same HOT 1
- [Question] 如何在GPU上进行训练
- [BUG] BiLSTM_Model.load_model('saved_ner_model')源代码加载模型报错 HOT 1
- [Question] HOT 1
- [BUG] 自定义模型,多个特征输入使用多个embed,模型fit报错,还需要重定义哪些方法来支持? HOT 2
- 简单调用BiLSTM_CRF模型,使用最基本bert-chinese作为embedding,运行报错layer_crf does not support masking HOT 1
- Got 'Blas xGEMMBatched launch failed' using BERT + BiLSTM
- Columns and DataType Not Explicitly Set on line 77 of classifications.py
- [Question] NER任务,使用load_model.predict()方法进行标签预测时,若句子长度超过128会被截断,应该如何处理。
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kashgari.