Skip to content

Commit

Permalink
Try garbage collecting to avoid GPU OOM when running the tests
Browse files Browse the repository at this point in the history
Suggested here:

pytest-dev/pytest#10296 (comment)

seems that explicitly releasing the GPU resources might be necessary to let torch know there is unused memory
  • Loading branch information
AngledLuffa committed Oct 28, 2024
1 parent 0732628 commit c5cb489
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions stanza/tests/pipeline/test_pipeline_sentiment_processor.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import gc

import pytest
import stanza
Expand All @@ -21,6 +22,7 @@ def pipeline(self):
"""
A reusable pipeline with the NER module
"""
gc.collect()
return stanza.Pipeline(dir=TEST_MODELS_DIR, processors="tokenize,sentiment")

def test_simple(self, pipeline):
Expand Down

0 comments on commit c5cb489

Please sign in to comment.