Giter VIP home page Giter VIP logo

Comments (13)

BrikerMan avatar BrikerMan commented on May 18, 2024

BERT 速度就这么慢,暂时没有办法优化。参考:http://eliyar.biz/nlp_chinese_bert_ner/

from kashgari.

wayneowen7 avatar wayneowen7 commented on May 18, 2024

谢谢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.

BrikerMan avatar BrikerMan commented on May 18, 2024

GPU 上可能会比较快,我这两天找时间测试一下。还有我们也在规划从 keras 转到 tf.keras #77 ,到时候保存模型,再用 serving 方式去预测,应该还能有所提升。

from kashgari.

wayneowen7 avatar wayneowen7 commented on May 18, 2024

太好了,谢谢您的回复:smiley:持续关注

from kashgari.

Rainman242 avatar Rainman242 commented on May 18, 2024

我也是predict特别慢啊,更加夸张的是1个sample需要1.3秒。(我的sequence length = 512)
其实我fit一个batch=32也只要4秒左右。
请问作者大大,有没有batch predict之类的方法可以调用?

from kashgari.

BrikerMan avatar BrikerMan commented on May 18, 2024

@Rainman242 predit 方法可以传数组,就会 batch predict。慢目前没有很好地解决办法。

from kashgari.

alexwwang avatar alexwwang commented on May 18, 2024

from kashgari.

BrikerMan avatar BrikerMan commented on May 18, 2024

可以在 tf.keras 版本尝试看看,但是 crf 本身也会比较慢,如果对性能要求比较高,可以尝试不用 crf 层。

from kashgari.

SunYanCN avatar SunYanCN commented on May 18, 2024

@alexwwang , @wayneowen7 , @Rainman242 ,https://github.com/SunYanCN/BERT-chinese-text-classification-and-deployment, This project may be helpful

from kashgari.

BrikerMan avatar BrikerMan commented on May 18, 2024

@wayneowen7 @Rainman242 试试 tf.keras 分支的 tf-serving 部署

BiLSTM_CRF_Model, 100 sequence_length 测试结果如下:

1080Ti-GPU 50ms
CPU 200ms

from kashgari.

qiuwei avatar qiuwei commented on May 18, 2024

谢谢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.

BrikerMan avatar BrikerMan commented on May 18, 2024

@qiuwei 可以分享一下优化经验么?

from kashgari.

JianWenJun avatar JianWenJun commented on May 18, 2024

@qiuwei 望大佬分享一下经验~

from kashgari.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.