Unverified Commit fe616f35 authored by Matthijs Hollemans's avatar Matthijs Hollemans Committed by GitHub
Browse files

no more dummies for speech processors (#21517)

parent 1d9c26a4
...@@ -391,6 +391,7 @@ _import_structure = { ...@@ -391,6 +391,7 @@ _import_structure = {
"models.speech_to_text": [ "models.speech_to_text": [
"SPEECH_TO_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP", "SPEECH_TO_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP",
"Speech2TextConfig", "Speech2TextConfig",
"Speech2TextProcessor",
], ],
"models.speech_to_text_2": [ "models.speech_to_text_2": [
"SPEECH_TO_TEXT_2_PRETRAINED_CONFIG_ARCHIVE_MAP", "SPEECH_TO_TEXT_2_PRETRAINED_CONFIG_ARCHIVE_MAP",
...@@ -403,6 +404,7 @@ _import_structure = { ...@@ -403,6 +404,7 @@ _import_structure = {
"SPEECHT5_PRETRAINED_HIFIGAN_CONFIG_ARCHIVE_MAP", "SPEECHT5_PRETRAINED_HIFIGAN_CONFIG_ARCHIVE_MAP",
"SpeechT5Config", "SpeechT5Config",
"SpeechT5HifiGanConfig", "SpeechT5HifiGanConfig",
"SpeechT5Processor",
], ],
"models.splinter": ["SPLINTER_PRETRAINED_CONFIG_ARCHIVE_MAP", "SplinterConfig", "SplinterTokenizer"], "models.splinter": ["SPLINTER_PRETRAINED_CONFIG_ARCHIVE_MAP", "SplinterConfig", "SplinterTokenizer"],
"models.squeezebert": ["SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "SqueezeBertConfig", "SqueezeBertTokenizer"], "models.squeezebert": ["SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "SqueezeBertConfig", "SqueezeBertTokenizer"],
...@@ -765,19 +767,6 @@ except OptionalDependencyNotAvailable: ...@@ -765,19 +767,6 @@ except OptionalDependencyNotAvailable:
else: else:
_import_structure["models.gpt2"].append("TFGPT2Tokenizer") _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 # Vision-specific objects
try: try:
if not is_vision_available(): if not is_vision_available():
...@@ -3852,7 +3841,11 @@ if TYPE_CHECKING: ...@@ -3852,7 +3841,11 @@ if TYPE_CHECKING:
from .models.sew import SEW_PRETRAINED_CONFIG_ARCHIVE_MAP, SEWConfig from .models.sew import SEW_PRETRAINED_CONFIG_ARCHIVE_MAP, SEWConfig
from .models.sew_d import SEW_D_PRETRAINED_CONFIG_ARCHIVE_MAP, SEWDConfig from .models.sew_d import SEW_D_PRETRAINED_CONFIG_ARCHIVE_MAP, SEWDConfig
from .models.speech_encoder_decoder import SpeechEncoderDecoderConfig 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 ( from .models.speech_to_text_2 import (
SPEECH_TO_TEXT_2_PRETRAINED_CONFIG_ARCHIVE_MAP, SPEECH_TO_TEXT_2_PRETRAINED_CONFIG_ARCHIVE_MAP,
Speech2Text2Config, Speech2Text2Config,
...@@ -3864,6 +3857,7 @@ if TYPE_CHECKING: ...@@ -3864,6 +3857,7 @@ if TYPE_CHECKING:
SPEECHT5_PRETRAINED_HIFIGAN_CONFIG_ARCHIVE_MAP, SPEECHT5_PRETRAINED_HIFIGAN_CONFIG_ARCHIVE_MAP,
SpeechT5Config, SpeechT5Config,
SpeechT5HifiGanConfig, SpeechT5HifiGanConfig,
SpeechT5Processor,
) )
from .models.splinter import SPLINTER_PRETRAINED_CONFIG_ARCHIVE_MAP, SplinterConfig, SplinterTokenizer from .models.splinter import SPLINTER_PRETRAINED_CONFIG_ARCHIVE_MAP, SplinterConfig, SplinterTokenizer
from .models.squeezebert import SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, SqueezeBertConfig, SqueezeBertTokenizer from .models.squeezebert import SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, SqueezeBertConfig, SqueezeBertTokenizer
...@@ -4181,15 +4175,6 @@ if TYPE_CHECKING: ...@@ -4181,15 +4175,6 @@ if TYPE_CHECKING:
else: else:
from .models.gpt2 import TFGPT2Tokenizer 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: try:
if not is_vision_available(): if not is_vision_available():
raise OptionalDependencyNotAvailable() raise OptionalDependencyNotAvailable()
......
...@@ -25,6 +25,7 @@ from ...utils import ( ...@@ -25,6 +25,7 @@ from ...utils import (
_import_structure = { _import_structure = {
"configuration_speech_to_text": ["SPEECH_TO_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP", "Speech2TextConfig"], "configuration_speech_to_text": ["SPEECH_TO_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP", "Speech2TextConfig"],
"processing_speech_to_text": ["Speech2TextProcessor"],
} }
try: try:
...@@ -43,14 +44,6 @@ except OptionalDependencyNotAvailable: ...@@ -43,14 +44,6 @@ except OptionalDependencyNotAvailable:
else: else:
_import_structure["feature_extraction_speech_to_text"] = ["Speech2TextFeatureExtractor"] _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: try:
if not is_tf_available(): if not is_tf_available():
raise OptionalDependencyNotAvailable() raise OptionalDependencyNotAvailable()
...@@ -80,6 +73,7 @@ else: ...@@ -80,6 +73,7 @@ else:
if TYPE_CHECKING: if TYPE_CHECKING:
from .configuration_speech_to_text import SPEECH_TO_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP, Speech2TextConfig from .configuration_speech_to_text import SPEECH_TO_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP, Speech2TextConfig
from .processing_speech_to_text import Speech2TextProcessor
try: try:
if not is_sentencepiece_available(): if not is_sentencepiece_available():
...@@ -97,14 +91,6 @@ if TYPE_CHECKING: ...@@ -97,14 +91,6 @@ if TYPE_CHECKING:
else: else:
from .feature_extraction_speech_to_text import Speech2TextFeatureExtractor 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: try:
if not is_tf_available(): if not is_tf_available():
raise OptionalDependencyNotAvailable() raise OptionalDependencyNotAvailable()
......
...@@ -29,6 +29,7 @@ _import_structure = { ...@@ -29,6 +29,7 @@ _import_structure = {
"SpeechT5Config", "SpeechT5Config",
"SpeechT5HifiGanConfig", "SpeechT5HifiGanConfig",
], ],
"processing_speecht5": ["SpeechT5Processor"],
} }
try: try:
...@@ -47,14 +48,6 @@ except OptionalDependencyNotAvailable: ...@@ -47,14 +48,6 @@ except OptionalDependencyNotAvailable:
else: else:
_import_structure["feature_extraction_speecht5"] = ["SpeechT5FeatureExtractor"] _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: try:
if not is_torch_available(): if not is_torch_available():
raise OptionalDependencyNotAvailable() raise OptionalDependencyNotAvailable()
...@@ -78,6 +71,7 @@ if TYPE_CHECKING: ...@@ -78,6 +71,7 @@ if TYPE_CHECKING:
SpeechT5Config, SpeechT5Config,
SpeechT5HifiGanConfig, SpeechT5HifiGanConfig,
) )
from .processing_speecht5 import SpeechT5Processor
try: try:
if not is_sentencepiece_available(): if not is_sentencepiece_available():
...@@ -95,14 +89,6 @@ if TYPE_CHECKING: ...@@ -95,14 +89,6 @@ if TYPE_CHECKING:
else: else:
from .feature_extraction_speecht5 import SpeechT5FeatureExtractor 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: try:
if not is_torch_available(): if not is_torch_available():
raise OptionalDependencyNotAvailable() raise OptionalDependencyNotAvailable()
......
# 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"])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment