模型:
该模型用于问答任务,给定问题和上下文,模型将尝试推断出答案文本、答案范围和置信度得分。模型是基于编码器的(roberta-base),带有问答语言模型头,在SQUADx数据集上进行了微调,精确匹配率为86.14%,f1得分为92.33%。
Live Demo: Question Answering Encoders vs Generative
请点击此链接进行 Encoder based Question Answering V2 ,请点击此链接进行 Generative Question Answering
示例代码:
from transformers import pipeline
model_checkpoint = "consciousAI/question-answering-roberta-base-s"
context = """
🤗 Transformers is backed by the three most popular deep learning libraries — Jax, PyTorch and TensorFlow — with a seamless integration
between them. It's straightforward to train your models with one before loading them for inference with the other.
"""
question = "Which deep learning libraries back 🤗 Transformers?"
question_answerer = pipeline("question-answering", model=model_checkpoint)
question_answerer(question=question, context=context)
SQUAD分割
预处理:
度量标准:
自定义训练循环:训练过程中使用了以下超参数:
| Epoch | F1 | Exact Match |
|---|---|---|
| 1.0 | 91.3085 | 84.5412 |
| 2.0 | 92.3304 | 86.1400 |