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 Mllama model."""
import gc
import unittest
import requests
@@ -30,6 +29,7 @@ from transformers import (
)
from transformers.models.mllama.configuration_mllama import MllamaTextConfig
from transformers.testing_utils import (
cleanup,
is_flaky,
require_bitsandbytes,
require_read_token,
@@ -396,8 +396,7 @@ class MllamaForConditionalGenerationIntegrationTest(unittest.TestCase):
self.instruct_model_checkpoint = "meta-llama/Llama-3.2-11B-Vision-Instruct"
def tearDown(self):
gc.collect()
torch.cuda.empty_cache()
cleanup(torch_device, gc_collect=True)
@slow
@require_torch_gpu