Views
No views yet
xlm-roberta-base on the English SQuAD v2 dataset for extractive question answering with unanswerable questions.xlm-roberta-base1from transformers import pipeline
2
3model_id = "takehika/xlm-roberta-en-squadv2-qa"
4qa = pipeline("question-answering", model=model_id, tokenizer=model_id)
5
6context = "I am a digital assistant created to support humans. I do not sleep or eat like people do. I live inside computers and servers around the world. I enjoy processing information, and my favorite energy source is electricity."
7questions = [
8 "What was the assistant created to do?",
9 "Where does it live?",
10 "What does it enjoy?",
11 "What is its favorite energy source?",
12 "What is the capital of France?"
13]
14
15threshold = 0.15
16results = qa(question=questions, context=context)
17
18for r in results:
19 if r["score"] < threshold:
20 r["answer"] = "" # no-answer
21 print(r)
22 rajpurkar/squad_v2)xlm-roberta-basef1checkpoint-14000
@article{DBLP:journals/corr/abs-1911-02116,
author = {Alexis Conneau and
Kartikay Khandelwal and
Naman Goyal and
Vishrav Chaudhary and
Guillaume Wenzek and
Francisco Guzm{\'{a}}n and
Edouard Grave and
Myle Ott and
Luke Zettlemoyer and
Veselin Stoyanov},
title = {Unsupervised Cross-lingual Representation Learning at Scale},
journal = {CoRR},
volume = {abs/1911.02116},
year = {2019},
url = {http://arxiv.org/abs/1911.02116},
eprinttype = {arXiv},
eprint = {1911.02116},
timestamp = {Mon, 11 Nov 2019 18:38:09 +0100},
biburl = {https://dblp.org/rec/journals/corr/abs-1911-02116.bib},
bibsource = {dblp computer science bibliography, https://dblp.org}
}@inproceedings{rajpurkar-etal-2018-know,
title = "Know What You Don{'}t Know: Unanswerable Questions for {SQ}u{AD}",
author = "Rajpurkar, Pranav and
Jia, Robin and
Liang, Percy",
editor = "Gurevych, Iryna and
Miyao, Yusuke",
booktitle = "Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers)",
month = jul,
year = "2018",
address = "Melbourne, Australia",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/P18-2124",
doi = "10.18653/v1/P18-2124",
pages = "784--789",
eprint={1806.03822},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
@inproceedings{rajpurkar-etal-2016-squad,
title = "{SQ}u{AD}: 100,000+ Questions for Machine Comprehension of Text",
author = "Rajpurkar, Pranav and
Zhang, Jian and
Lopyrev, Konstantin and
Liang, Percy",
editor = "Su, Jian and
Duh, Kevin and
Carreras, Xavier",
booktitle = "Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing",
month = nov,
year = "2016",
address = "Austin, Texas",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/D16-1264",
doi = "10.18653/v1/D16-1264",
pages = "2383--2392",
eprint={1606.05250},
archivePrefix={arXiv},
primaryClass={cs.CL},
}