rajpurkar/squad_v2
Viewer • Updated • 142k • 33.6k • 251
How to use yirenl2/plm_qa with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("question-answering", model="yirenl2/plm_qa") # Load model directly
from transformers import AutoTokenizer, AutoModelForQuestionAnswering
tokenizer = AutoTokenizer.from_pretrained("yirenl2/plm_qa")
model = AutoModelForQuestionAnswering.from_pretrained("yirenl2/plm_qa")# Load model directly
from transformers import AutoTokenizer, AutoModelForQuestionAnswering
tokenizer = AutoTokenizer.from_pretrained("yirenl2/plm_qa")
model = AutoModelForQuestionAnswering.from_pretrained("yirenl2/plm_qa")We fine-tuned the roBERTa-based model (https://huggingface.co/deepset/roberta-base-squad2) over LiveSafe community safety dialogue data for event argument extraction with the objective of question-answering.
from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
model_name = "yirenl2/plm_qa"
# a) Get predictions
nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
QA_input = {
'question': 'What is the location of the incident?',
'context': 'I was attacked by someone in front of the bus station.'
}
res = nlp(QA_input)
# b) Load model & tokenizer
model = AutoModelForQuestionAnswering.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("question-answering", model="yirenl2/plm_qa")