avoid calling gc.collect and cuda.empty_cache (#34514)

* update

* update

* update

* update

* update

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
This commit is contained in:
Yih-Dar
2024-10-31 16:36:13 +01:00
committed by GitHub
parent dca93ca076
commit ab98f0b0a1
24 changed files with 77 additions and 94 deletions

View File

@@ -14,7 +14,6 @@
# limitations under the License.
"""Testing suite for the PyTorch VideoLlava model."""
import gc
import unittest
import numpy as np
@@ -29,6 +28,7 @@ from transformers import (
is_vision_available,
)
from transformers.testing_utils import (
cleanup,
require_bitsandbytes,
require_torch,
require_torch_gpu,
@@ -437,8 +437,7 @@ class VideoLlavaForConditionalGenerationIntegrationTest(unittest.TestCase):
self.processor = VideoLlavaProcessor.from_pretrained("LanguageBind/Video-LLaVA-7B-hf")
def tearDown(self):
gc.collect()
torch.cuda.empty_cache()
cleanup(torch_device, gc_collect=True)
@slow
@require_bitsandbytes