no more dummies for speech processors (#21517)

This commit is contained in:
Matthijs Hollemans 2023-02-08 17:41:54 +01:00 committed by GitHub
parent 1d9c26a4b8
commit fe616f35c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 71 deletions

View File

@ -391,6 +391,7 @@ _import_structure = {
"models.speech_to_text": [
"SPEECH_TO_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP",
"Speech2TextConfig",
"Speech2TextProcessor",
],
"models.speech_to_text_2": [
"SPEECH_TO_TEXT_2_PRETRAINED_CONFIG_ARCHIVE_MAP",
@ -403,6 +404,7 @@ _import_structure = {
"SPEECHT5_PRETRAINED_HIFIGAN_CONFIG_ARCHIVE_MAP",
"SpeechT5Config",
"SpeechT5HifiGanConfig",
"SpeechT5Processor",
],
"models.splinter": ["SPLINTER_PRETRAINED_CONFIG_ARCHIVE_MAP", "SplinterConfig", "SplinterTokenizer"],
"models.squeezebert": ["SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "SqueezeBertConfig", "SqueezeBertTokenizer"],
@ -765,19 +767,6 @@ except OptionalDependencyNotAvailable:
else:
_import_structure["models.gpt2"].append("TFGPT2Tokenizer")
try:
if not (is_sentencepiece_available() and is_speech_available()):
raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
from .utils import dummy_sentencepiece_and_speech_objects
_import_structure["utils.dummy_sentencepiece_and_speech_objects"] = [
name for name in dir(dummy_sentencepiece_and_speech_objects) if not name.startswith("_")
]
else:
_import_structure["models.speech_to_text"].append("Speech2TextProcessor")
_import_structure["models.speecht5"].append("SpeechT5Processor")
# Vision-specific objects
try:
if not is_vision_available():
@ -3852,7 +3841,11 @@ if TYPE_CHECKING:
from .models.sew import SEW_PRETRAINED_CONFIG_ARCHIVE_MAP, SEWConfig
from .models.sew_d import SEW_D_PRETRAINED_CONFIG_ARCHIVE_MAP, SEWDConfig
from .models.speech_encoder_decoder import SpeechEncoderDecoderConfig
from .models.speech_to_text import SPEECH_TO_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP, Speech2TextConfig
from .models.speech_to_text import (
SPEECH_TO_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP,
Speech2TextConfig,
Speech2TextProcessor,
)
from .models.speech_to_text_2 import (
SPEECH_TO_TEXT_2_PRETRAINED_CONFIG_ARCHIVE_MAP,
Speech2Text2Config,
@ -3864,6 +3857,7 @@ if TYPE_CHECKING:
SPEECHT5_PRETRAINED_HIFIGAN_CONFIG_ARCHIVE_MAP,
SpeechT5Config,
SpeechT5HifiGanConfig,
SpeechT5Processor,
)
from .models.splinter import SPLINTER_PRETRAINED_CONFIG_ARCHIVE_MAP, SplinterConfig, SplinterTokenizer
from .models.squeezebert import SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, SqueezeBertConfig, SqueezeBertTokenizer
@ -4181,15 +4175,6 @@ if TYPE_CHECKING:
else:
from .models.gpt2 import TFGPT2Tokenizer
try:
if not (is_speech_available() and is_sentencepiece_available()):
raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
from .utils.dummy_sentencepiece_and_speech_objects import *
else:
from .models.speech_to_text import Speech2TextProcessor
from .models.speecht5 import SpeechT5Processor
try:
if not is_vision_available():
raise OptionalDependencyNotAvailable()

View File

@ -25,6 +25,7 @@ from ...utils import (
_import_structure = {
"configuration_speech_to_text": ["SPEECH_TO_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP", "Speech2TextConfig"],
"processing_speech_to_text": ["Speech2TextProcessor"],
}
try:
@ -43,14 +44,6 @@ except OptionalDependencyNotAvailable:
else:
_import_structure["feature_extraction_speech_to_text"] = ["Speech2TextFeatureExtractor"]
try:
if not (is_speech_available() and is_sentencepiece_available()):
raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
pass
else:
_import_structure["processing_speech_to_text"] = ["Speech2TextProcessor"]
try:
if not is_tf_available():
raise OptionalDependencyNotAvailable()
@ -80,6 +73,7 @@ else:
if TYPE_CHECKING:
from .configuration_speech_to_text import SPEECH_TO_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP, Speech2TextConfig
from .processing_speech_to_text import Speech2TextProcessor
try:
if not is_sentencepiece_available():
@ -97,14 +91,6 @@ if TYPE_CHECKING:
else:
from .feature_extraction_speech_to_text import Speech2TextFeatureExtractor
try:
if not (is_speech_available() and is_sentencepiece_available()):
raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
pass
else:
from .processing_speech_to_text import Speech2TextProcessor
try:
if not is_tf_available():
raise OptionalDependencyNotAvailable()

View File

@ -29,6 +29,7 @@ _import_structure = {
"SpeechT5Config",
"SpeechT5HifiGanConfig",
],
"processing_speecht5": ["SpeechT5Processor"],
}
try:
@ -47,14 +48,6 @@ except OptionalDependencyNotAvailable:
else:
_import_structure["feature_extraction_speecht5"] = ["SpeechT5FeatureExtractor"]
try:
if not (is_speech_available() and is_sentencepiece_available()):
raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
pass
else:
_import_structure["processing_speecht5"] = ["SpeechT5Processor"]
try:
if not is_torch_available():
raise OptionalDependencyNotAvailable()
@ -78,6 +71,7 @@ if TYPE_CHECKING:
SpeechT5Config,
SpeechT5HifiGanConfig,
)
from .processing_speecht5 import SpeechT5Processor
try:
if not is_sentencepiece_available():
@ -95,14 +89,6 @@ if TYPE_CHECKING:
else:
from .feature_extraction_speecht5 import SpeechT5FeatureExtractor
try:
if not (is_speech_available() and is_sentencepiece_available()):
raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
pass
else:
from .processing_speecht5 import SpeechT5Processor
try:
if not is_torch_available():
raise OptionalDependencyNotAvailable()

View File

@ -1,16 +0,0 @@
# This file is autogenerated by the command `make fix-copies`, do not edit.
from ..utils import DummyObject, requires_backends
class Speech2TextProcessor(metaclass=DummyObject):
_backends = ["sentencepiece", "speech"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["sentencepiece", "speech"])
class SpeechT5Processor(metaclass=DummyObject):
_backends = ["sentencepiece", "speech"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["sentencepiece", "speech"])