Views
No views yet
t5-small) for text summarization tasks. It has been trained on a diverse set of text data to generate concise and coherent summaries from input text.t5-small1from transformers import T5Tokenizer, T5ForConditionalGeneration
2
3# Load the fine-tuned model and tokenizer
4model = T5ForConditionalGeneration.from_pretrained("kawinduwijewardhane/BriefT5")
5tokenizer = T5Tokenizer.from_pretrained("kawinduwijewardhane/BriefT5")
6
7# Input text for summarization
8input_text = "Your long input text here."
9
10# Tokenize and summarize
11inputs = tokenizer(input_text, return_tensors="pt", max_length=512, truncation=True)
12summary_ids = model.generate(inputs["input_ids"], max_length=150, num_beams=4, early_stopping=True)
13
14# Decode the summary
15summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
16print(summary)
17language: Specifies the language the model supports, in this case, English (en).license: Describes the licensing information for your model, here it is set to MIT (you can change it depending on your license).tags: These tags help categorize your model on Hugging Face and make it easier for others to discover. I've added tags like summarization, t5, text-to-text, and fine-tuned.