Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests] enable automatic speech recognition pipeline tests on XPU #29308

Merged
merged 2 commits into from
Mar 4, 2024

Conversation

faaany
Copy link
Contributor

@faaany faaany commented Feb 27, 2024

What does this PR do?

"cuda" and "cuda:0" are hard-coded in test_whisper_longform and test_seamless_v2 of test_pipelines_automatic_speech_recognition.py. So when running the unit tests on XPU, I get 2 failing tests:

================================================= short test summary info ==================================================
SKIPPED [1] tests/pipelines/test_pipelines_automatic_speech_recognition.py:269: test requires TensorFlow
FAILED tests/pipelines/test_pipelines_automatic_speech_recognition.py::AutomaticSpeechRecognitionPipelineTests::test_seamless_v2 - AssertionError: Torch not compiled with CUDA enabled
FAILED tests/pipelines/test_pipelines_automatic_speech_recognition.py::AutomaticSpeechRecognitionPipelineTests::test_whisper_longform - AssertionError: Torch not compiled with CUDA enabled
============================= 2 failed, 40 passed, 1 skipped, 31 warnings in 203.95s (0:03:23) =============================

This PR proposes to use the device-agnostic variable torch_device instead of the hard-coded "cuda" device. After the fix,
all unit tests in test_pipelines_automatic_speech_recognition.py run through on XPU as shown below:

================================================= short test summary info ==================================================
SKIPPED [1] tests/pipelines/test_pipelines_automatic_speech_recognition.py:269: test requires TensorFlow
================================== 42 passed, 1 skipped, 32 warnings in 219.40s (0:03:39) ==================================

Who can review?

@Narsil @ArthurZucker

@faaany faaany changed the title [tests] enable automatic speech recognition pipeline test on XPU [tests] enable automatic speech recognition pipeline tests on XPU Feb 27, 2024
Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but we might need to add require_torch_gpu as it was tested on GPU

@faaany
Copy link
Contributor Author

faaany commented Feb 29, 2024

LGTM but we might need to add require_torch_gpu as it was tested on GPU

If I change require_torch to require_torch_gpu, this test will be skipped on Intel GPU. But I don't see any reason why this test should only work on NV GPU. Maybe we can change require_torch to require_torch_accelerator to let CPU save this test, what do you think?

@ArthurZucker
Copy link
Collaborator

Alright, I just want to make sure our CI runs it with cuda because the values were obtained with it and not 100% sure you always get the same. Though it is not logits some device can get it differently, we'll leave that and I'll merge thanks for the PR

@ArthurZucker ArthurZucker merged commit aade711 into huggingface:main Mar 4, 2024
18 checks passed
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

damithsenanayake pushed a commit to damithsenanayake/transformers that referenced this pull request Mar 7, 2024
itazap pushed a commit that referenced this pull request May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants