Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,17 @@ def test_compressed_matches_decompressed(self):
def tearDownClass(cls):
if os.path.isdir(cls.test_dir):
shutil.rmtree(cls.test_dir)

if hasattr(cls, "decompressed_model") and cls.decompressed_model is not None:
cls.decompressed_model.cpu()
if hasattr(cls, "uncompressed_model") and cls.uncompressed_model is not None:
cls.uncompressed_model.cpu()
del cls.decompressed_model
del cls.uncompressed_model
del cls.tokenizer

torch.cuda.empty_cache()
torch.cuda.synchronize()


@requires_gpu
Expand Down Expand Up @@ -168,6 +176,14 @@ def test_compressed_matches_decompressed__hf_quantizer(self):
def tearDownClass(cls):
if os.path.isdir(cls.test_dir):
shutil.rmtree(cls.test_dir)

if hasattr(cls, "decompressed_model") and cls.decompressed_model is not None:
cls.decompressed_model.cpu()
if hasattr(cls, "compressed_model") and cls.compressed_model is not None:
cls.compressed_model.cpu()
del cls.decompressed_model
del cls.compressed_model
del cls.tokenizer

torch.cuda.empty_cache()
torch.cuda.synchronize()
Loading