This model is t5-base fine-tuned on Xsum dataset for text summarization.
T5 is an encoder-decoder model pre-trained on a multi-task mixture of unsupervised and supervised tasks and for which each task is converted into a text-to-text format.
To train the T5 model for text-summarization, I have used "summarize" prefix before every sentence and gave the encoding of this sentence as input ids and attention mask.
For the labels, I used the encoding of the summaries as the decoder input ids and decoder attention mask.
1predictions = []
2tokenised_dataset = tokenizer(documents, truncation=True, padding='max_length', max_length=1024, return_tensors='pt')
3source_ids = tokenised_dataset['input_ids']
4source_mask = tokenised_dataset['attention_mask']
5output = model.generate(input_ids=source_ids, attention_mask=source_mask, max_length=256)
6print(tokenizer.decode(output[0], skip_special_tokens=True))
We report the ROUGE-1, ROUGE-2 and ROUGE-L on the test datasets.