From cba49cb2a6da61c8f8f041cd3f0b419164b6180b Mon Sep 17 00:00:00 2001 From: Blanchon Date: Fri, 3 Jan 2025 14:37:42 +0100 Subject: [PATCH] Change `is_soundfile_availble` to `is_soundfile_available` (#35030) --- src/transformers/agents/agent_types.py | 6 +++--- src/transformers/file_utils.py | 2 +- src/transformers/testing_utils.py | 4 ++-- src/transformers/utils/__init__.py | 2 +- src/transformers/utils/import_utils.py | 2 +- tests/agents/test_agent_types.py | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/transformers/agents/agent_types.py b/src/transformers/agents/agent_types.py index f5be7462657..75973777b9a 100644 --- a/src/transformers/agents/agent_types.py +++ b/src/transformers/agents/agent_types.py @@ -19,7 +19,7 @@ import numpy as np -from ..utils import is_soundfile_availble, is_torch_available, is_vision_available, logging +from ..utils import is_soundfile_available, is_torch_available, is_vision_available, logging logger = logging.get_logger(__name__) @@ -36,7 +36,7 @@ else: Tensor = object -if is_soundfile_availble(): +if is_soundfile_available(): import soundfile as sf @@ -179,7 +179,7 @@ class AgentAudio(AgentType, str): def __init__(self, value, samplerate=16_000): super().__init__(value) - if not is_soundfile_availble(): + if not is_soundfile_available(): raise ImportError("soundfile must be installed in order to handle audio.") self._path = None diff --git a/src/transformers/file_utils.py b/src/transformers/file_utils.py index 2d9477727ea..c13d506a613 100644 --- a/src/transformers/file_utils.py +++ b/src/transformers/file_utils.py @@ -105,7 +105,7 @@ is_sentencepiece_available, is_seqio_available, is_sklearn_available, - is_soundfile_availble, + is_soundfile_available, is_spacy_available, is_speech_available, is_tensor, diff --git a/src/transformers/testing_utils.py b/src/transformers/testing_utils.py index 00a7ee59664..6890a536889 100644 --- a/src/transformers/testing_utils.py +++ b/src/transformers/testing_utils.py @@ -116,7 +116,7 @@ is_scipy_available, is_sentencepiece_available, is_seqio_available, - is_soundfile_availble, + is_soundfile_available, is_spacy_available, is_sudachi_available, is_sudachi_projection_available, @@ -1122,7 +1122,7 @@ def require_soundfile(test_case): These tests are skipped when soundfile isn't installed. """ - return unittest.skipUnless(is_soundfile_availble(), "test requires soundfile")(test_case) + return unittest.skipUnless(is_soundfile_available(), "test requires soundfile")(test_case) def require_deepspeed(test_case): diff --git a/src/transformers/utils/__init__.py b/src/transformers/utils/__init__.py index 74b6d39fda5..641899eb278 100755 --- a/src/transformers/utils/__init__.py +++ b/src/transformers/utils/__init__.py @@ -189,7 +189,7 @@ is_sentencepiece_available, is_seqio_available, is_sklearn_available, - is_soundfile_availble, + is_soundfile_available, is_spacy_available, is_speech_available, is_sudachi_available, diff --git a/src/transformers/utils/import_utils.py b/src/transformers/utils/import_utils.py index f880535dd6f..5d18c5568a5 100755 --- a/src/transformers/utils/import_utils.py +++ b/src/transformers/utils/import_utils.py @@ -1159,7 +1159,7 @@ def is_training_run_on_sagemaker(): return "SAGEMAKER_JOB_NAME" in os.environ -def is_soundfile_availble(): +def is_soundfile_available(): return _soundfile_available diff --git a/tests/agents/test_agent_types.py b/tests/agents/test_agent_types.py index 168ab1bbc9f..5b54c83d0a5 100644 --- a/tests/agents/test_agent_types.py +++ b/tests/agents/test_agent_types.py @@ -20,13 +20,13 @@ from transformers.agents.agent_types import AgentAudio, AgentImage, AgentText from transformers.testing_utils import get_tests_dir, require_soundfile, require_torch, require_vision -from transformers.utils import is_soundfile_availble, is_torch_available, is_vision_available +from transformers.utils import is_soundfile_available, is_torch_available, is_vision_available if is_torch_available(): import torch -if is_soundfile_availble(): +if is_soundfile_available(): import soundfile as sf if is_vision_available():