模型:
该模型用于问答任务,给定问题和上下文,模型会试图推断答案文本、答案范围和置信度得分。模型是仅编码器(deepset/roberta-base-squad2),带有QuestionAnswering LM Head,在SQUADx数据集上进行了微调,得到了精确匹配:84.83和F1:91.80的性能得分。
Live Demo: Question Answering Encoders vs Generative
请点击此处进行 Encoder based Question Answering V1 ,请点击此处进行 Generative Question Answering
示例代码:
from transformers import pipeline
model_checkpoint = "consciousAI/question-answering-roberta-base-s-v2"
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分割
预处理:
指标:
自定义训练循环:训练过程中使用了以下超参数:
{'exact_match': 84.83443708609272, 'f1': 91.79987545811638}