【问题标题】:How to improve Allen NLP question answering performance如何提高 Allen NLP 问答性能
【发布时间】:2021-04-03 18:12:40
【问题描述】:

我正在试用 Allen NLP 预训练模型进行问答。

在线演示在这里:https://demo.allennlp.org/reading-comprehension

我创建了一个 python 脚本来尝试各种模型。

这是我笔记本电脑上的基准测试摘要

  • Macbook Pro (2017)
  • 2.9 Ghz Intel i7 四核
  • 16G 内存
Benchmark transformer-qa bidaf-model bidaf-elmo-model
loading time 31.6 seconds 1.6 seconds 13.8 seconds
questions
Who stars in The Matrix? 794 ms 62 ms 1,798 ms
where does polar bear live 2,211 ms 96 ms 7,125 ms
how much does a polar bear weigh 2,435 ms 98 ms 7,082 ms
what is lightning 1,361 ms 69 ms 3,173 ms
How many lightning bolts strike earth 1,019 ms 47 ms 2,885 ms

查看output 我可以看到所有 3 个模型都提供了很好的答案。我喜欢transformer-qa 模型,但预测需要一段时间(以秒为单位)。

有没有办法加快预测时间?

谢谢!

【问题讨论】:

    标签: python nlp question-answering allennlp


    【解决方案1】:

    transformer-qa 模型包含更多参数,因此预计需要更长时间。加快推理时间的一种方法是使用 GPU。如果您一次在一个实例上运行predict,则加速可能并不显着,批量运行应该会有所帮助。

    【讨论】:

    • 您好 akshitab,您能给我任何参考链接或示例,了解如何批量处理段落吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-02
    • 2021-06-13
    • 2020-09-09
    • 2012-06-24
    • 2021-05-28
    • 2020-03-31
    相关资源
    最近更新 更多