模型:
mrm8488/bert-medium-finetuned-squadv2
由 Google Research 创建并在 SQuAD 2.0 上进行了Q&A的下游任务的微调。
模型大小(训练后):157.46 MB
于2020年3月11日发布
该模型是 Well-Read Students Learn Better: On the Importance of Pre-training Compact Models 中引用的24个较小的BERT模型之一(仅适用于英语,不区分大小写,使用WordPiece掩码进行训练)。
较小的BERT模型适用于计算资源受限的环境。它们可以像原始BERT模型一样进行微调。然而,在知识蒸馏的背景下,它们在更大且更准确的教师产生的微调标签的上下文中最有效。
SQuAD2.0 将SQuAD1.1中的10万个问题与由群众工作者敌意编写的超过5万个无法回答的问题相结合,使其看起来与可回答的问题相似。为了在SQuAD2.0上表现良好,系统不仅必须在可能时回答问题,还必须确定段落不支持任何答案并避免回答。
Dataset | Split | # samples |
---|---|---|
SQuAD2.0 | train | 130k |
SQuAD2.0 | eval | 12.3k |
该模型在Tesla P100 GPU和25GB RAM上进行训练。微调脚本可以在 here 找到
Metric | # Value |
---|---|
EM | 65.95 |
F1 | 70.11 |
{ "exact": 65.95637159942727, "f1": 70.11632254245896, "total": 11873, "HasAns_exact": 67.79689608636977, "HasAns_f1": 76.12872765631123, "HasAns_total": 5928, "NoAns_exact": 64.12111017661901, "NoAns_f1": 64.12111017661901, "NoAns_total": 5945, "best_exact": 65.96479407058031, "best_exact_thresh": 0.0, "best_f1": 70.12474501361196, "best_f1_thresh": 0.0 }
Model | EM | F1 score | SIZE (MB) |
---|---|---|---|
12311321 | 48.60 | 49.73 | 16.74 |
12312321 | 57.12 | 60.86 | 24.34 |
12313321 | 56.31 | 59.65 | 42.63 |
12314321 | 63.51 | 66.78 | 66.76 |
12315321 | 60.49 | 64.21 | 109.74 |
12316321 | 65.95 | 70.11 | 157.46 |
使用pipelines快速使用:
from transformers import pipeline qa_pipeline = pipeline( "question-answering", model="mrm8488/bert-small-finetuned-squadv2", tokenizer="mrm8488/bert-small-finetuned-squadv2" ) qa_pipeline({ 'context': "Manuel Romero has been working hardly in the repository hugginface/transformers lately", 'question': "Who has been working hard for hugginface/transformers lately?" }) # Output:
{ "answer": "Manuel Romero", "end": 13, "score": 0.9939319924374637, "start": 0 }
qa_pipeline({ 'context': "Manuel Romero has been working remotely in the repository hugginface/transformers lately", 'question': "How has been working Manuel Romero?" }) # Output:
{ "answer": "remotely", "end": 39, "score": 0.3612058272768017, "start": 31 }
创建者: Manuel Romero/@mrm8488 | LinkedIn
在西班牙创造 with ♥