Model Card for Model ID
Model Details
Model Description
This is the model is used for making or generating summary of the provided paragraph.
- Developed by: BEASTBOYJAY
- Model type: Transformer(encoder)
- Language(s) (NLP): English
- Finetuned from model: Bert-base-uncased
Uses
- For the summarization purpose only
Bias, Risks, and Limitations
This model is fine-tuned on very small dataset can need more fine-tuning for better results.(Fine-tuned this model only for eductional purposes)
How to Get Started with the Model
Use the code below to get started with the model.
from transformers import EncoderDecoderModel, BertTokenizer
class TextSummarizer:
def __init__(self, model_path, tokenizer_name="bert-base-uncased"):
self.tokenizer = BertTokenizer.from_pretrained(tokenizer_name)
self.model = EncoderDecoderModel.from_pretrained(model_path)
def summarize(self, text, max_input_length=512):
inputs = self.tokenizer(
text,
return_tensors="pt",
truncation=True,
padding="max_length",
max_length=max_input_length,
)
summary_ids = self.model.generate(
inputs["input_ids"],
attention_mask=inputs["attention_mask"],
decoder_start_token_id=self.tokenizer.cls_token_id,
max_length=128,
num_beams=4,
length_penalty=1.5,
no_repeat_ngram_size=1,
early_stopping=True,
)
summary = self.tokenizer.decode(summary_ids[0], skip_special_tokens=True)
return summary
if __name__ == "__main__":
summarizer = TextSummarizer(model_path="BEASTBOYJAY/my-fine-tuned-summarizer")
test_article = "Your article or paragraph"
summary = summarizer.summarize(test_article)
print("Generated Summary:", summary)
- Downloads last month
- 107
Inference Providers
NEW
This model is not currently available via any of the supported Inference Providers.
Model tree for BEASTBOYJAY/my-fine-tuned-summarizer
Base model
google-bert/bert-base-uncased