Update README.md
Browse files
README.md
CHANGED
@@ -313,6 +313,31 @@ You can also use the same code to split a document into batches of 4096, etc., a
|
|
313 |
|
314 |
See [train with a script](https://huggingface.co/docs/transformers/run_scripts) and [the summarization scripts](https://github.com/huggingface/transformers/tree/main/examples/pytorch/summarization)
|
315 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
316 |
* * *
|
317 |
|
318 |
## Training procedure
|
|
|
313 |
|
314 |
See [train with a script](https://huggingface.co/docs/transformers/run_scripts) and [the summarization scripts](https://github.com/huggingface/transformers/tree/main/examples/pytorch/summarization)
|
315 |
|
316 |
+
### Is there an easier way to use this?
|
317 |
+
|
318 |
+
I have created a python package utility for this reason. It's called [textsum](https://github.com/pszemraj/textsum), and you can use it to load models and summarize things in a few lines of code.
|
319 |
+
|
320 |
+
```sh
|
321 |
+
pip install textsum
|
322 |
+
```
|
323 |
+
|
324 |
+
Use `textsum` in python with this model:
|
325 |
+
|
326 |
+
```python
|
327 |
+
from textsum.summarize import Summarizer
|
328 |
+
|
329 |
+
summarizer = Summarizer(model_name_or_path="pszemraj/long-t5-tglobal-xl-16384-book-summary")
|
330 |
+
|
331 |
+
# summarize a long string
|
332 |
+
out_str = summarizer.summarize_string('This is a long string of text that will be summarized.')
|
333 |
+
print(f'summary: {out_str}')
|
334 |
+
```
|
335 |
+
|
336 |
+
This package provides easy-to-use interfaces for using summarization models on text documents of arbitrary length. Currently implemented interfaces include a python API, CLI, and a shareable demo app.
|
337 |
+
|
338 |
+
For details, explanations, and docs, see the README (_linked above_) or the [wiki](https://github.com/pszemraj/textsum/wiki).
|
339 |
+
|
340 |
+
|
341 |
* * *
|
342 |
|
343 |
## Training procedure
|