



"""simple docstring"""
import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin


class  SCREAMING_SNAKE_CASE__			(				lowerCAmelCase__ ):
    lowercase__  			= """Speech2TextFeatureExtractor"""
    lowercase__  			= """Speech2TextTokenizer"""

    def __init__(					self      :					Union[str, Any]			,	lowerCAmelCase_      :					List[Any]			,	lowerCAmelCase_      :					Any):







      """simple docstring"""







      super().__init__(__a			,	__a)
      lowercase_             =			self.feature_extractor
      lowercase_             =			False

    def __call__(					self      :					Dict			,	*lowerCAmelCase_      :					Union[str, Any]			,	**lowerCAmelCase_      :					Tuple):







      """simple docstring"""







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

      if "raw_speech" in kwargs:
        warnings.warn("""Using `raw_speech` as a keyword argument is deprecated. Use `audio` instead.""")
        lowercase_             =			kwargs.pop("""raw_speech""")
      else:
        lowercase_             =			kwargs.pop("""audio"""			,	__a)
      lowercase_             =			kwargs.pop("""sampling_rate"""			,	__a)
      lowercase_             =			kwargs.pop("""text"""			,	__a)
      if len(__a) > 0:
        lowercase_             =			args[0]
        lowercase_             =			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:
        lowercase_             =			self.feature_extractor(__a			,	*__a			,	sampling_rate=__a			,	**__a)
      if text is not None:
        lowercase_             =			self.tokenizer(__a			,	**__a)

      if text is None:
        return inputs
      elif audio is None:
        return encodings
      else:
        lowercase_             =			encodings["""input_ids"""]
        return inputs

    def        _UpperCAmelCase						(					self      :					Tuple			,	*lowerCAmelCase_      :					Any			,	**lowerCAmelCase_      :					int):







      """simple docstring"""







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

    def        _UpperCAmelCase						(					self      :					List[str]			,	*lowerCAmelCase_      :					Union[str, Any]			,	**lowerCAmelCase_      :					Any):







      """simple docstring"""







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




    @contextmanager
    def        _UpperCAmelCase						(					self      :					List[str]):







      """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.""")
      lowercase_             =			True
      lowercase_             =			self.tokenizer
      yield
      lowercase_             =			self.feature_extractor
      lowercase_             =			False





"""simple docstring"""


from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


A	:  Union[str, Any]            =     {
    "configuration_timesformer": ["TIMESFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "TimesformerConfig"],
}

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	A	:  Optional[int]            =     [
	    "TIMESFORMER_PRETRAINED_MODEL_ARCHIVE_LIST",
	    "TimesformerModel",
	    "TimesformerForVideoClassification",
	    "TimesformerPreTrainedModel",
	]

if TYPE_CHECKING:
	from .configuration_timesformer import TIMESFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, TimesformerConfig

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_timesformer import (
		    TIMESFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
		    TimesformerForVideoClassification,
		    TimesformerModel,
		    TimesformerPreTrainedModel,
		)

else:
	import sys

	A	:  List[str]            =     _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)




