Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
datasets:
|
3 |
+
- Samsung/samsum
|
4 |
+
base_model:
|
5 |
+
- google-t5/t5-small
|
6 |
+
pipeline_tag: summarization
|
7 |
+
---
|
8 |
+
|
9 |
+
# T5 Small for Conversation Summarization
|
10 |
+
|
11 |
+
## Usage
|
12 |
+
|
13 |
+
```py
|
14 |
+
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
15 |
+
|
16 |
+
model_checkpoint = "ahlad/t5-small-finetuned-samsum"
|
17 |
+
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
|
18 |
+
model = AutoModelForSeq2SeqLM.from_pretrained(model_checkpoint)
|
19 |
+
|
20 |
+
input_text = """
|
21 |
+
Emma: Did you finish the book I lent you?
|
22 |
+
Liam: Yes, I couldn’t put it down! The twist at the end was insane.
|
23 |
+
Emma: I know, right? I didn’t see it coming at all. What did you think of the main character?
|
24 |
+
Liam: Honestly, I thought they were a bit frustrating at first, but they grew on me.
|
25 |
+
Emma: Same here. I loved how they developed by the end. Are you up for another book from the series?
|
26 |
+
Liam: Absolutely! Pass it my way.
|
27 |
+
"""
|
28 |
+
|
29 |
+
inputs = tokenizer(input_text, return_tensors="pt")
|
30 |
+
|
31 |
+
outputs = model.generate(**inputs)
|
32 |
+
summary = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
33 |
+
|
34 |
+
print("Summary:", summary)
|
35 |
+
```
|