Python 当未从变压器中指定时,是否随机选择预培训模型

Python 当未从变压器中指定时,是否随机选择预培训模型,python,nlp,huggingface-transformers,nlg,Python,Nlp,Huggingface Transformers,Nlg,我正在尝试使用huggingface的模型实现一个QA系统。我不明白的一件事是,当我没有指定用于回答问题的预训练模型时,模型是随机选择的吗 from transformers import pipeline # Allocate a pipeline for question-answering question_answerer = pipeline('question-answering') question_answerer({ 'question': 'What is t

我正在尝试使用huggingface的模型实现一个QA系统。我不明白的一件事是,当我没有指定用于回答问题的预训练模型时,模型是随机选择的吗

from transformers import pipeline

# Allocate a pipeline for question-answering

question_answerer = pipeline('question-answering')
question_answerer({

     'question': 'What is the name of the repository ?',
     'context': 'Pipeline have been included in the huggingface/transformers repository'

})
输出:

{'score':0.5135612454720828,'start':35,'end':59,'answer':'huggingface/transformers'}


我知道如何通过添加模型的名称(例如bertbase uncased)作为模型参数来指定模型,但是当您不指定任何内容时,它使用哪一个?它是否在拥抱脸上使用所有型号的组合?我找不到答案。

模型不是随机选择的。管道中的任何任务都会选择适当的模型,以接近该任务的模型为准。选择了一个模型,该模型根据所需任务和数据集的目标进行了严格训练。例如,
情绪分析
管道可以选择在SST任务上训练的模型

同样地,对于
问答
,它选择
AutoModelForQuestionAnswering
类,其中
distilbert base cased decreated destricted sequest team
作为默认模型,因为团队数据集与问答任务相关联

要获取列表,您可以查看变量
支持的\u任务