






import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin




class 							__A	(     lowercase_					):





				"""simple docstring"""







				UpperCamelCase__					: int     					="""AutoFeatureExtractor"""
				UpperCamelCase__					: List[Any]     					="""Speech2Text2Tokenizer"""


				def __init__(					self				,    lowerCamelCase__				,    lowerCamelCase__       ):




									"""simple docstring"""

									super().__init__(__UpperCamelCase				,    __UpperCamelCase       )
									__UpperCamelCase :   int									=self.feature_extractor
									__UpperCamelCase :   Any									=False


				def __call__(					self				,    *lowerCamelCase__				,    **lowerCamelCase__       ):




									"""simple docstring"""

									if self._in_target_context_manager:
														return self.current_processor(*__UpperCamelCase				,    **__UpperCamelCase       )

									if "raw_speech" in kwargs:
														warnings.warn('Using `raw_speech` as a keyword argument is deprecated. Use `audio` instead.'       )
														__UpperCamelCase :   Optional[int]									=kwargs.pop('raw_speech'       )
									else:
														__UpperCamelCase :   int									=kwargs.pop('audio'				,    __UpperCamelCase       )
									__UpperCamelCase :   str									=kwargs.pop('sampling_rate'				,    __UpperCamelCase       )
									__UpperCamelCase :   int									=kwargs.pop('text'				,    __UpperCamelCase       )
									if len(__UpperCamelCase       ) > 0:
														__UpperCamelCase :   List[Any]									=args[0]
														__UpperCamelCase :   List[str]									=args[1:]

									if audio is None and text is None:
														raise ValueError('You need to specify either an `audio` or `text` input to process.'       )

									if audio is not None:
														__UpperCamelCase :   Optional[Any]									=self.feature_extractor(__UpperCamelCase				,    *__UpperCamelCase				,    sampling_rate=__UpperCamelCase				,    **__UpperCamelCase       )
									if text is not None:
														__UpperCamelCase :   Optional[Any]									=self.tokenizer(__UpperCamelCase				,    **__UpperCamelCase       )

									if text is None:
														return inputs
									elif audio is None:
														return encodings
									else:
														__UpperCamelCase :   Dict									=encodings['input_ids']
														return inputs


				def  __lowercase				(					self				,    *lowerCamelCase__				,    **lowerCamelCase__       ):




									"""simple docstring"""

									return self.tokenizer.batch_decode(*__UpperCamelCase				,    **__UpperCamelCase       )


				def  __lowercase				(					self				,    *lowerCamelCase__				,    **lowerCamelCase__       ):




									"""simple docstring"""

									return self.tokenizer.decode(*__UpperCamelCase				,    **__UpperCamelCase       )







				@contextmanager
				def  __lowercase				(					self       ):




									"""simple docstring"""

									warnings.warn(
									    '`as_target_processor` is deprecated and will be removed in v5 of Transformers. You can process your '
									    'labels by using the argument `text` of the regular `__call__` method (either in the same call as '
									    'your audio inputs, or in a separate call.'       )
									__UpperCamelCase :   Optional[int]									=True
									__UpperCamelCase :   str									=self.tokenizer
									yield
									__UpperCamelCase :   Dict									=self.feature_extractor
									__UpperCamelCase :   Any									=False








"""simple docstring"""
from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_torch_available,
)


_snake_case	:						Any					=					{
    'configuration_unispeech_sat': ['UNISPEECH_SAT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'UniSpeechSatConfig'],
}

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		_snake_case	:						str					=					[
		    'UNISPEECH_SAT_PRETRAINED_MODEL_ARCHIVE_LIST',
		    'UniSpeechSatForAudioFrameClassification',
		    'UniSpeechSatForCTC',
		    'UniSpeechSatForPreTraining',
		    'UniSpeechSatForSequenceClassification',
		    'UniSpeechSatForXVector',
		    'UniSpeechSatModel',
		    'UniSpeechSatPreTrainedModel',
		]

if TYPE_CHECKING:
		from .configuration_unispeech_sat import UNISPEECH_SAT_PRETRAINED_CONFIG_ARCHIVE_MAP, UniSpeechSatConfig

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_unispeech_sat import (
				    UNISPEECH_SAT_PRETRAINED_MODEL_ARCHIVE_LIST,
				    UniSpeechSatForAudioFrameClassification,
				    UniSpeechSatForCTC,
				    UniSpeechSatForPreTraining,
				    UniSpeechSatForSequenceClassification,
				    UniSpeechSatForXVector,
				    UniSpeechSatModel,
				    UniSpeechSatPreTrainedModel,
				)

else:
		import sys

		_snake_case	:						Union[str, Any]					=					_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)


