Sehong's picture
Update README.md
3458e28
|
raw
history blame
1.79 kB
metadata
language: en
tags:
  - t5
datasets:
  - squad
license: mit

Question Generation Model

Fine-tuning Dataset

SQuAD 1.1

Demo

https://huggingface.co/Sehong/t5-large-QuestionGeneration

How to use

import torch
from transformers import PreTrainedTokenizerFast
from transformers import T5ForConditionalGeneration

tokenizer = PreTrainedTokenizerFast.from_pretrained('Sehong/t5-large-QuestionGeneration')
model = T5ForConditionalGeneration.from_pretrained('t5-large')

text = "Saint Bern ##ade ##tte So ##ubi ##rous [SEP] Architectural ##ly , the school has a Catholic character . At ##op the Main Building ' s gold dome is a golden statue of the Virgin Mary . Immediately in front of the Main Building and facing it , is a copper statue of Christ with arms up ##rai ##sed with the legend "" V ##eni ##te Ad Me O ##m ##nes "" . Next to the Main Building is the Basilica of the Sacred Heart . Immediately behind the b ##asi ##lica is the G ##rot ##to , a Marian place of prayer and reflection . It is a replica of the g ##rot ##to at Lou ##rdes , France where the Virgin Mary reputed ##ly appeared to Saint Bern ##ade ##tte So ##ubi ##rous in 1858 . At the end of the main drive ( and in a direct line that connects through 3 statues and the Gold Dome ) , is a simple , modern stone statue of Mary ."

raw_input_ids = tokenizer.encode(text)
input_ids = [tokenizer.bos_token_id] + raw_input_ids + [tokenizer.eos_token_id]

summary_ids = model.generate(torch.tensor([input_ids]))

decode = tokenizer.decode(summary_ids.squeeze().tolist(), skip_special_tokens=True)

decode = decode.replace(' # # ', '').replace('  ', ' ').replace(' ##', '')

print(decode)

Evalutation

BLEU-1: 51.333

BLEU-2: 36.742

BLEU-3: 28.218

BLEU-4: 22.289

METEOR: 26.126

ROUGE-L: 51.069