Downloads · 30 days
4
25% of all-time downloads
Andrew0488/t5_summarizer
t5_summarizer is a machine learning model from Andrew0488. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers.
This model bases on T5-base model, finetuned using bbc-news-summary dataset Example of using:
Downloads · 30 days
4
25% of all-time downloads
All-time downloads
16
Public
Parameters
223M
2.7 GB on disk
Likes
0
Public
Click a slice to open those files.
.pt1.8 GB · 67%
From the Hugging Face model README
This model bases on T5-base model, finetuned using bbc-news-summary dataset Example of using:
from transformers import pipeline, T5ForConditionalGeneration, T5Tokenizer
import torch
model_name = "Andrew0488/t5-summarizer"
model = T5ForConditionalGeneration.from_pretrained(model_name).cuda()
tokenizer = T5Tokenizer.from_pretrained(model_name)
def t5_summary(text: str):
inputs = tokenizer.encode(
"summarize: " + text,
return_tensors='pt',
max_length=2000,
truncation=True,
padding='max_length'
).to(torch.device("cuda"))
# Generate the summary
summary_ids = model.generate(
inputs,
max_length=250,
num_beams=5
)
return tokenizer.decode(summary_ids[0], skip_special_tokens=True)