device agnostic models testing (#27146)

* device agnostic models testing

* add decorator `require_torch_fp16`

* make style

* apply review suggestion

* Oops, the fp16 decorator was misused
This commit is contained in:
Hz, Ji
2023-11-01 01:12:14 +08:00
committed by GitHub
parent 77930f8a01
commit 50378cbf6c
51 changed files with 369 additions and 154 deletions

View File

@@ -29,6 +29,7 @@ from datasets import load_dataset
from transformers import Wav2Vec2Config, is_torch_available
from transformers.testing_utils import (
CaptureLogger,
backend_empty_cache,
is_pt_flax_cross_test,
is_pyctcdecode_available,
is_torchaudio_available,
@@ -1455,7 +1456,7 @@ class Wav2Vec2ModelIntegrationTest(unittest.TestCase):
super().tearDown()
# clean-up as much as possible GPU memory occupied by PyTorch
gc.collect()
torch.cuda.empty_cache()
backend_empty_cache(torch_device)
def _load_datasamples(self, num_samples):
ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")