From cbbe30749b425f7c327acdab11473b33567a6e26 Mon Sep 17 00:00:00 2001 From: Patrick von Platen Date: Wed, 10 Jan 2024 22:35:36 +0100 Subject: [PATCH] [Whisper] Fix slow test (#28407) * [Whisper] Fix slow test * update * update * update * update --------- Co-authored-by: ydshieh --- .github/workflows/self-nightly-scheduled.yml | 1 + .github/workflows/self-past.yml | 1 + .github/workflows/self-push-amd.yml | 1 + .github/workflows/self-scheduled-amd.yml | 1 + .github/workflows/self-scheduled.yml | 3 +++ tests/models/whisper/test_modeling_whisper.py | 4 +++- 6 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/self-nightly-scheduled.yml b/.github/workflows/self-nightly-scheduled.yml index 37dc98f340a16d..b87951fd8d912d 100644 --- a/.github/workflows/self-nightly-scheduled.yml +++ b/.github/workflows/self-nightly-scheduled.yml @@ -16,6 +16,7 @@ env: OMP_NUM_THREADS: 8 MKL_NUM_THREADS: 8 RUN_SLOW: yes + HF_HUB_READ_TOKEN: ${{ secrets.HF_HUB_READ_TOKEN }} SIGOPT_API_TOKEN: ${{ secrets.SIGOPT_API_TOKEN }} TF_FORCE_GPU_ALLOW_GROWTH: true RUN_PT_TF_CROSS_TESTS: 1 diff --git a/.github/workflows/self-past.yml b/.github/workflows/self-past.yml index ed60c92f6745a8..c2a6c652e458ba 100644 --- a/.github/workflows/self-past.yml +++ b/.github/workflows/self-past.yml @@ -27,6 +27,7 @@ env: OMP_NUM_THREADS: 8 MKL_NUM_THREADS: 8 RUN_SLOW: yes + HF_HUB_READ_TOKEN: ${{ secrets.HF_HUB_READ_TOKEN }} SIGOPT_API_TOKEN: ${{ secrets.SIGOPT_API_TOKEN }} TF_FORCE_GPU_ALLOW_GROWTH: true RUN_PT_TF_CROSS_TESTS: 1 diff --git a/.github/workflows/self-push-amd.yml b/.github/workflows/self-push-amd.yml index 19857981b12dbd..2630ea72ef7529 100644 --- a/.github/workflows/self-push-amd.yml +++ b/.github/workflows/self-push-amd.yml @@ -15,6 +15,7 @@ env: PYTEST_TIMEOUT: 60 TF_FORCE_GPU_ALLOW_GROWTH: true RUN_PT_TF_CROSS_TESTS: 1 + HF_HUB_READ_TOKEN: ${{ secrets.HF_HUB_READ_TOKEN }} jobs: check_runner_status: diff --git a/.github/workflows/self-scheduled-amd.yml b/.github/workflows/self-scheduled-amd.yml index 3d41a3b95e6c50..57d2f0339bd056 100644 --- a/.github/workflows/self-scheduled-amd.yml +++ b/.github/workflows/self-scheduled-amd.yml @@ -16,6 +16,7 @@ env: OMP_NUM_THREADS: 8 MKL_NUM_THREADS: 8 RUN_SLOW: yes + HF_HUB_READ_TOKEN: ${{ secrets.HF_HUB_READ_TOKEN }} SIGOPT_API_TOKEN: ${{ secrets.SIGOPT_API_TOKEN }} diff --git a/.github/workflows/self-scheduled.yml b/.github/workflows/self-scheduled.yml index 995df2e07880ac..80bd63357c81f8 100644 --- a/.github/workflows/self-scheduled.yml +++ b/.github/workflows/self-scheduled.yml @@ -20,6 +20,9 @@ env: OMP_NUM_THREADS: 8 MKL_NUM_THREADS: 8 RUN_SLOW: yes + # For gated repositories, we still need to agree to share information on the Hub repo. page in order to get access. + # This token is created under the bot `hf-transformers-bot`. + HF_HUB_READ_TOKEN: ${{ secrets.HF_HUB_READ_TOKEN }} SIGOPT_API_TOKEN: ${{ secrets.SIGOPT_API_TOKEN }} TF_FORCE_GPU_ALLOW_GROWTH: true RUN_PT_TF_CROSS_TESTS: 1 diff --git a/tests/models/whisper/test_modeling_whisper.py b/tests/models/whisper/test_modeling_whisper.py index 6ca7bfcb5d7377..0192b83f929afc 100644 --- a/tests/models/whisper/test_modeling_whisper.py +++ b/tests/models/whisper/test_modeling_whisper.py @@ -1651,8 +1651,10 @@ def test_large_generation_multilingual(self): model = WhisperForConditionalGeneration.from_pretrained("openai/whisper-large") model.to(torch_device) - ds = load_dataset("common_voice", "ja", split="test", streaming=True) + token = os.getenv("HF_HUB_READ_TOKEN", True) + ds = load_dataset("mozilla-foundation/common_voice_6_1", "ja", split="test", streaming=True, token=token) ds = ds.cast_column("audio", datasets.Audio(sampling_rate=16_000)) + input_speech = next(iter(ds))["audio"]["array"] input_features = processor.feature_extractor(raw_speech=input_speech, return_tensors="pt").input_features.to( torch_device