Avoid OOM when other tests are failing (#39758)
fix Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
This commit is contained in:
@@ -31,6 +31,7 @@ from transformers import (
|
||||
)
|
||||
from transformers.testing_utils import (
|
||||
Expectations,
|
||||
cleanup,
|
||||
get_device_properties,
|
||||
is_torch_available,
|
||||
is_torchaudio_available,
|
||||
@@ -1256,6 +1257,12 @@ class MusicgenMelodyIntegrationTests(unittest.TestCase):
|
||||
def model(self):
|
||||
return MusicgenMelodyForConditionalGeneration.from_pretrained("ylacombe/musicgen-melody").to(torch_device)
|
||||
|
||||
def setUp(self):
|
||||
cleanup(torch_device, gc_collect=True)
|
||||
|
||||
def tearDown(self):
|
||||
cleanup(torch_device, gc_collect=True)
|
||||
|
||||
@cached_property
|
||||
def processor(self):
|
||||
return MusicgenMelodyProcessor.from_pretrained("ylacombe/musicgen-melody")
|
||||
|
||||
Reference in New Issue
Block a user