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 (
|
from transformers.testing_utils import (
|
||||||
Expectations,
|
Expectations,
|
||||||
|
cleanup,
|
||||||
get_device_properties,
|
get_device_properties,
|
||||||
is_torch_available,
|
is_torch_available,
|
||||||
is_torchaudio_available,
|
is_torchaudio_available,
|
||||||
@@ -1256,6 +1257,12 @@ class MusicgenMelodyIntegrationTests(unittest.TestCase):
|
|||||||
def model(self):
|
def model(self):
|
||||||
return MusicgenMelodyForConditionalGeneration.from_pretrained("ylacombe/musicgen-melody").to(torch_device)
|
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
|
@cached_property
|
||||||
def processor(self):
|
def processor(self):
|
||||||
return MusicgenMelodyProcessor.from_pretrained("ylacombe/musicgen-melody")
|
return MusicgenMelodyProcessor.from_pretrained("ylacombe/musicgen-melody")
|
||||||
|
|||||||
Reference in New Issue
Block a user