Instructions to use ashishkat/summarization with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ashishkat/summarization with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("ashishkat/summarization") model = AutoModelForSeq2SeqLM.from_pretrained("ashishkat/summarization") - Notebooks
- Google Colab
- Kaggle
| ``` | |
| ### encode the input paragraph to summarize | |
| tokenized_text = tokenizer.encode_plus( | |
| str(text_input), | |
| return_attention_mask = True, | |
| return_tensors="pt") | |
| ### pass the tokenized paragraph in model | |
| generated_token = model.generate( | |
| input_ids = tokenized_text["input_ids"], | |
| attention_mask=tokenized_text["attention_mask"], | |
| max_length = 256, | |
| use_cache=True, | |
| ) | |
| ### decode the summarized paragraph token | |
| summarized_paragraph = [ | |
| tokenizer.decode(token_ids=ids, skip_special_tokens=True) for ids in generated_token | |
| ] | |
| Summarized paragraph is the final result. | |
| ``` |