



'''simple docstring'''


import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin







class 						UpperCAmelCase						(		__a):


 '''simple docstring'''




 __magic_name__       :			Union[str, Any]	=   "AutoFeatureExtractor"
 __magic_name__       :			Tuple	=   "Speech2Text2Tokenizer"




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



      """simple docstring"""







      super().__init__(lowerCAmelCase_				,	lowerCAmelCase_)
      a_									=self.feature_extractor
      a_									=False




 def __call__( self				,	*lowerCAmelCase_				,	**lowerCAmelCase_)			->   List[str]:



      """simple docstring"""







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

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

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




 def    lowercase_	( self				,	*lowerCAmelCase_				,	**lowerCAmelCase_)			->   Optional[int]:



      """simple docstring"""







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




 def    lowercase_	( self				,	*lowerCAmelCase_				,	**lowerCAmelCase_)			->   str:



      """simple docstring"""







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




 @contextmanager
 def    lowercase_	( self)			->   int:



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







'''simple docstring'''


from typing import TYPE_CHECKING

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


lowercase											=      {
    '''configuration_align''': [
        '''ALIGN_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''AlignConfig''',
        '''AlignTextConfig''',
        '''AlignVisionConfig''',
    ],
    '''processing_align''': ['''AlignProcessor'''],
}

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  lowercase											=      [
      '''ALIGN_PRETRAINED_MODEL_ARCHIVE_LIST''',
      '''AlignModel''',
      '''AlignPreTrainedModel''',
      '''AlignTextModel''',
      '''AlignVisionModel''',
  ]

if TYPE_CHECKING:
  from .configuration_align import (
      ALIGN_PRETRAINED_CONFIG_ARCHIVE_MAP,
      AlignConfig,
      AlignTextConfig,
      AlignVisionConfig,
  )
  from .processing_align import AlignProcessor

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_align import (
        ALIGN_PRETRAINED_MODEL_ARCHIVE_LIST,
        AlignModel,
        AlignPreTrainedModel,
        AlignTextModel,
        AlignVisionModel,
    )

else:
  import sys

  lowercase											=      _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)


