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", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,21 +1,16 @@
|
|
| 1 |
-
|
| 2 |
-
#### encode the input paragraph to summarize
|
| 3 |
tokenized_text = tokenizer.encode_plus(
|
| 4 |
str(text_input),
|
| 5 |
return_attention_mask = True,
|
| 6 |
return_tensors="pt")
|
| 7 |
|
| 8 |
-
#### summarize the paragraph
|
| 9 |
-
|
| 10 |
generated_token = model.generate(
|
| 11 |
input_ids = tokenized_text["input_ids"],
|
| 12 |
attention_mask=tokenized_text["attention_mask"],
|
| 13 |
max_length = 256,
|
| 14 |
use_cache=True,
|
| 15 |
)
|
| 16 |
-
#### decode the token
|
| 17 |
summarized_paragraph = [
|
| 18 |
tokenizer.decode(token_ids=ids, skip_special_tokens=True) for ids in generated_token
|
| 19 |
]
|
| 20 |
-
|
| 21 |
-
'''
|
|
|
|
| 1 |
+
"""
|
|
|
|
| 2 |
tokenized_text = tokenizer.encode_plus(
|
| 3 |
str(text_input),
|
| 4 |
return_attention_mask = True,
|
| 5 |
return_tensors="pt")
|
| 6 |
|
|
|
|
|
|
|
| 7 |
generated_token = model.generate(
|
| 8 |
input_ids = tokenized_text["input_ids"],
|
| 9 |
attention_mask=tokenized_text["attention_mask"],
|
| 10 |
max_length = 256,
|
| 11 |
use_cache=True,
|
| 12 |
)
|
|
|
|
| 13 |
summarized_paragraph = [
|
| 14 |
tokenizer.decode(token_ids=ids, skip_special_tokens=True) for ids in generated_token
|
| 15 |
]
|
| 16 |
+
"""
|
|
|