Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
bitsandbytes
Commits
bed0860b
Unverified
Commit
bed0860b
authored
Apr 02, 2024
by
Matthew Douglas
Committed by
GitHub
Apr 02, 2024
Browse files
Tests: improve memory usage (#1147)
parent
494de206
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
tests/conftest.py
tests/conftest.py
+9
-0
No files found.
tests/conftest.py
View file @
bed0860b
import
gc
import
pytest
import
pytest
import
torch
import
torch
...
@@ -20,6 +22,13 @@ def pytest_runtest_call(item):
...
@@ -20,6 +22,13 @@ def pytest_runtest_call(item):
raise
raise
@
pytest
.
hookimpl
(
trylast
=
True
)
def
pytest_runtest_teardown
(
item
,
nextitem
):
gc
.
collect
()
if
torch
.
cuda
.
is_available
():
torch
.
cuda
.
empty_cache
()
@
pytest
.
fixture
(
scope
=
"session"
)
@
pytest
.
fixture
(
scope
=
"session"
)
def
requires_cuda
()
->
bool
:
def
requires_cuda
()
->
bool
:
cuda_available
=
torch
.
cuda
.
is_available
()
cuda_available
=
torch
.
cuda
.
is_available
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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