Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
texta
texta-mlp-python
Commits
053b0582
Commit
053b0582
authored
Apr 04, 2022
by
Wael Ramadan
Browse files
feat: [#535] flush cuda memory
parent
2b775a8f
Pipeline
#7969
passed with stage
in 19 minutes and 58 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
texta_mlp/mlp.py
View file @
053b0582
import
gc
import
logging
import
os
import
pathlib
...
...
@@ -310,6 +311,9 @@ class MLP:
if
"sentences"
in
analyzers
and
spans
==
"sentence"
:
document
.
fact_spans_to_sent
()
gc
.
collect
()
torch
.
cuda
.
empty_cache
()
return
document
.
to_json
()
else
:
return
None
...
...
@@ -393,4 +397,7 @@ class MLP:
result
=
doc
.
document_to_json
(
use_default_doc_path
=
False
)
docs
[
actual_index
]
=
result
gc
.
collect
()
torch
.
cuda
.
empty_cache
()
return
docs
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment