模型:

ZTamas/xlm-roberta-large-squad2_impossible_long_answer

英文

这个模型是在milqa数据集上对deepset/xlm-roberta-large-squad2进行了微调的版本。

安装大型roberta模型的软件包:

sentencepiece==0.1.97
protobuf==3.20.0

如何使用:

from transformers import pipeline
qa_pipeline = pipeline(
  "question-answering",
  model = "ZTamas/xlm-roberta-large-squad2_impossible_long_answer",
  tokenizer = "ZTamas/xlm-roberta-large-squad2_impossible_long_answer",
  device = 0,                      #GPU selection, -1 on CPU
  handle_impossible_answer = True,
  max_answer_len = 1000            #This can be modified, but to let the model's
                                   #answer be as long as it wants so I
                                   #decided to add a big number
  )

predictions = qa_pipeline({
    'context': context,            
    'question': question           
})

print(predictions)