Skip to content

[seamless_m4t] Skip some tests when speech is not available #38430

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

remi-or
Copy link

@remi-or remi-or commented May 28, 2025

This PR adds the require_speech decorator and adds it to three tests in seamless_m4t and seamless_m4t_v2 that fail with an ImportError if is_speech_available() == False

@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.

@mht-sharma mht-sharma requested a review from ydshieh May 28, 2025 11:23
@Rocketknight1
Copy link
Member

cc @ydshieh

"""
Decorator marking a test that requires speech. These tests are skipped when speech isn't available.
"""
return unittest.skipUnless(is_speech_available(), "test requires speech")(test_case)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here we have to decide what we really require.

def is_speech_available():
    # For now this depends on torchaudio but the exact dependency might evolve in the future.
    return _torchaudio_available

and in setup.py we have

extras["speech"] = deps_list("torchaudio") + extras["audio"]

If we want to require torchaudio + audio for the tests, then is_speech_available is not enough.
Also the message test requires speech will be confusing as speech is not a python library.

If we only want to require torchaudio, then we have def require_torchaudio(test_case):.

cc @eustlb

Copy link
Author

Choose a reason for hiding this comment

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

Yes, it would be nice to figure out if is_speech_available is needed or redundant. If it isn't, I will change the decorator to require_torchaudio. I have no idea on this though.
As for the message, we can change it to when the packages required for speech models are not available ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I am happy to merge for now if the message is changed to

test requires torchaudio

And come back to check the details later.

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.

4 participants