add python usage
Browse files
README.md
CHANGED
@@ -84,6 +84,26 @@ A fine-tuned version of [google/long-t5-tglobal-base](https://huggingface.co/goo
|
|
84 |
- 20+ epochs of fine-tuning from the base model on V100/A100 GPUs
|
85 |
- all training used 16384 token input / 1024 max output
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
## Intended uses & limitations
|
89 |
|
|
|
84 |
- 20+ epochs of fine-tuning from the base model on V100/A100 GPUs
|
85 |
- all training used 16384 token input / 1024 max output
|
86 |
|
87 |
+
## How-To in Python
|
88 |
+
|
89 |
+
Install/update transformers `pip install -U transformers`:
|
90 |
+
|
91 |
+
Summarize text with pipeline:
|
92 |
+
|
93 |
+
```
|
94 |
+
from transformers import pipeline
|
95 |
+
|
96 |
+
summarizer = pipeline(
|
97 |
+
'summarization',
|
98 |
+
'pszemraj/long-t5-tglobal-base-16384-book-summary',
|
99 |
+
)
|
100 |
+
long_text = "Here is a lot of text I don't want to read. Replace me"
|
101 |
+
|
102 |
+
result = summarizer(long_text)
|
103 |
+
print(result[0]['summary_text'])
|
104 |
+
```
|
105 |
+
|
106 |
+
You can [other parameters related to generating text with beam search](https://huggingface.co/blog/how-to-generate) to get even higher quality results.
|
107 |
|
108 |
## Intended uses & limitations
|
109 |
|