Views
No views yet
1from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
2repo_id = "etweedy/roberta-base-squad-v2"
3QA_pipeline = pipeline(
4 task = 'question-answering',
5 model=repo_id,
6 tokenizer=repo_id,
7 handle_impossible_answer = True
8)1input = {
2 'question': 'Who invented Twinkies?',
3 'context': 'Twinkies were invented on April 6, 1930, by Canadian-born baker James Alexander Dewar for the Continental Baking Company in Schiller Park, Illinois.'
4}
5response = QA_pipeline(**input)batch_size = 16
n_epochs = 3
learning_rate = 3e-5
base_LM_model = ["roberta-base"](https://huggingface.co/roberta-base)
max_seq_len = 384
stride=128
lr_schedule = LinearWarmup
warmup_proportion = 0.0
mixed_precision="fp16"1{"exact": 79.87029394424324,
2"f1": 82.91251169582613,
3"total": 11873,
4"HasAns_exact": 77.93522267206478,
5"HasAns_f1": 84.02838248389763,
6"HasAns_total": 5928,
7"NoAns_exact": 81.79983179142137,
8"NoAns_f1": 81.79983179142137,
9"NoAns_total": 5945}1@article{DBLP:journals/corr/abs-1907-11692,
2 author = {Yinhan Liu and
3 Myle Ott and
4 Naman Goyal and
5 Jingfei Du and
6 Mandar Joshi and
7 Danqi Chen and
8 Omer Levy and
9 Mike Lewis and
10 Luke Zettlemoyer and
11 Veselin Stoyanov},
12 title = {RoBERTa: {A} Robustly Optimized {BERT} Pretraining Approach},
13 journal = {CoRR},
14 volume = {abs/1907.11692},
15 year = {2019},
16 url = {http://arxiv.org/abs/1907.11692},
17 archivePrefix = {arXiv},
18 eprint = {1907.11692},
19 timestamp = {Thu, 01 Aug 2019 08:59:33 +0200},
20 biburl = {https://dblp.org/rec/journals/corr/abs-1907-11692.bib},
21 bibsource = {dblp computer science bibliography, https://dblp.org}
22}