BERT(双向编码器表示来自Transformer)是一种预训练的深度双向表示学习模型,由Google在2018年提出。该模型在多个自然语言处理(NLP)任务中取得了显著的性能提升。BERT-base是BERT的一个基础版本,其配置包括12层的Transformer编码器、768个隐藏单元、12个注意力头以及总共110M的参数。
“BERT-base uncased model fine-tuned on SQuAD v1”是指使用BERT-base版本的未区分大小写的模型,在SQuAD v1(斯坦福问答数据集版本1)数据集上进行微调的过程。SQuAD v1是一个广泛使用的阅读理解数据集,其中包含10万个问题-段落对,每个问题都有三个由人类标注的答案。微调是指使用特定任务的标记数据来继续训练预训练模型,以便让模型学习如何针对该任务进行预测。
使用openmind接口
from openmind import pipeline
pipe = pipeline('question-answering', model=model_path, device=device)
question = What day was the game played on?"
context = "The game was played on February 7, 2016 at Levi's Stadium in the San Francisco Bay Area at Santa Clara, California."
print(pipe(question = question, context = context))
{'score': 0.8730505704879761, 'start': 23, 'end': 39, 'answer': 'February 7, 2016'}调用example下inference.py
cd examples
python inference.py