Views
No views yet
alinet/balanced_qg dataset (resolved_augmented subset).1from transformers import BartConfig, BartForConditionalGeneration, BartTokenizer
2
3model_name = "alinet/bart-base-balanced-ra-qg"
4
5tokenizer = BartTokenizer.from_pretrained(model_name)
6model = BartForConditionalGeneration.from_pretrained(model_name)
7
8def run_model(input_string, **generator_args):
9 input_ids = tokenizer.encode(input_string, return_tensors="pt")
10 res = model.generate(input_ids, **generator_args)
11 output = tokenizer.batch_decode(res, skip_special_tokens=True)
12 print(output)
13
14run_model("Stanford Question Answering Dataset (SQuAD) is a reading comprehension dataset, consisting of questions posed by crowdworkers on a set of Wikipedia articles, where the answer to every question is a segment of text, or span, from the corresponding reading passage, or the question might be unanswerable.", max_length=32, num_beams=4)
15# ['What is the term for a reading comprehension dataset consisting of questions posed by crowdworkers?']