Spaces:
Runtime error
Runtime error
add forced gc after predict
Browse files
app.py
CHANGED
|
@@ -5,6 +5,7 @@ Usage:
|
|
| 5 |
python app.py
|
| 6 |
"""
|
| 7 |
import contextlib
|
|
|
|
| 8 |
import logging
|
| 9 |
import os
|
| 10 |
import random
|
|
@@ -72,6 +73,11 @@ def predict(
|
|
| 72 |
batch_length=token_batch_length,
|
| 73 |
**settings,
|
| 74 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
return summaries
|
| 76 |
|
| 77 |
|
|
|
|
| 5 |
python app.py
|
| 6 |
"""
|
| 7 |
import contextlib
|
| 8 |
+
import gc
|
| 9 |
import logging
|
| 10 |
import os
|
| 11 |
import random
|
|
|
|
| 73 |
batch_length=token_batch_length,
|
| 74 |
**settings,
|
| 75 |
)
|
| 76 |
+
|
| 77 |
+
del model
|
| 78 |
+
del tokenizer
|
| 79 |
+
gc.collect()
|
| 80 |
+
|
| 81 |
return summaries
|
| 82 |
|
| 83 |
|