Change is_soundfile_availble to is_soundfile_available (#35030)

This commit is contained in:
Blanchon
2025-01-03 14:37:42 +01:00
committed by GitHub
parent 42865860ec
commit cba49cb2a6
6 changed files with 10 additions and 10 deletions

View File

@@ -19,7 +19,7 @@ import uuid
import numpy as np 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__) logger = logging.get_logger(__name__)
@@ -36,7 +36,7 @@ if is_torch_available():
else: else:
Tensor = object Tensor = object
if is_soundfile_availble(): if is_soundfile_available():
import soundfile as sf import soundfile as sf
@@ -179,7 +179,7 @@ class AgentAudio(AgentType, str):
def __init__(self, value, samplerate=16_000): def __init__(self, value, samplerate=16_000):
super().__init__(value) super().__init__(value)
if not is_soundfile_availble(): if not is_soundfile_available():
raise ImportError("soundfile must be installed in order to handle audio.") raise ImportError("soundfile must be installed in order to handle audio.")
self._path = None self._path = None

View File

@@ -105,7 +105,7 @@ from .utils import (
is_sentencepiece_available, is_sentencepiece_available,
is_seqio_available, is_seqio_available,
is_sklearn_available, is_sklearn_available,
is_soundfile_availble, is_soundfile_available,
is_spacy_available, is_spacy_available,
is_speech_available, is_speech_available,
is_tensor, is_tensor,

View File

@@ -116,7 +116,7 @@ from .utils import (
is_scipy_available, is_scipy_available,
is_sentencepiece_available, is_sentencepiece_available,
is_seqio_available, is_seqio_available,
is_soundfile_availble, is_soundfile_available,
is_spacy_available, is_spacy_available,
is_sudachi_available, is_sudachi_available,
is_sudachi_projection_available, is_sudachi_projection_available,
@@ -1122,7 +1122,7 @@ def require_soundfile(test_case):
These tests are skipped when soundfile isn't installed. 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): def require_deepspeed(test_case):

View File

@@ -189,7 +189,7 @@ from .import_utils import (
is_sentencepiece_available, is_sentencepiece_available,
is_seqio_available, is_seqio_available,
is_sklearn_available, is_sklearn_available,
is_soundfile_availble, is_soundfile_available,
is_spacy_available, is_spacy_available,
is_speech_available, is_speech_available,
is_sudachi_available, is_sudachi_available,

View File

@@ -1159,7 +1159,7 @@ def is_training_run_on_sagemaker():
return "SAGEMAKER_JOB_NAME" in os.environ return "SAGEMAKER_JOB_NAME" in os.environ
def is_soundfile_availble(): def is_soundfile_available():
return _soundfile_available return _soundfile_available

View File

@@ -20,13 +20,13 @@ from pathlib import Path
from transformers.agents.agent_types import AgentAudio, AgentImage, AgentText 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.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(): if is_torch_available():
import torch import torch
if is_soundfile_availble(): if is_soundfile_available():
import soundfile as sf import soundfile as sf
if is_vision_available(): if is_vision_available():