

'''simple docstring'''







import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin


class    A__ ( _snake_case     ):
    lowercase		   =						"Speech2TextFeatureExtractor"
    lowercase		   =						"Speech2TextTokenizer"



    def __init__(   self						,			UpperCamelCase__						,			UpperCamelCase__    )  -> List[Any]:





           '''simple docstring'''
           super().__init__(UpperCamelCase__						,			UpperCamelCase__    )
           A_		   = self.feature_extractor
           A_		   = False



    def __call__(   self						,			*UpperCamelCase__						,			**UpperCamelCase__    )  -> Optional[Any]:





           '''simple docstring'''
           # For backward compatibility
           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."""    )
                  A_		   = kwargs.pop("""raw_speech"""    )
           else:
                  A_		   = kwargs.pop("""audio"""						,			UpperCamelCase__    )
           A_		   = kwargs.pop("""sampling_rate"""						,			UpperCamelCase__    )
           A_		   = kwargs.pop("""text"""						,			UpperCamelCase__    )
           if len(UpperCamelCase__    ) > 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(UpperCamelCase__						,			*UpperCamelCase__						,			sampling_rate=UpperCamelCase__						,			**UpperCamelCase__    )
           if text is not None:
                  A_		   = self.tokenizer(UpperCamelCase__						,			**UpperCamelCase__    )

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



    def    snake_case_     (   self						,			*UpperCamelCase__						,			**UpperCamelCase__    )  -> Optional[Any]:





           '''simple docstring'''
           return self.tokenizer.batch_decode(*UpperCamelCase__						,			**UpperCamelCase__    )



    def    snake_case_     (   self						,			*UpperCamelCase__						,			**UpperCamelCase__    )  -> List[str]:





           '''simple docstring'''
           return self.tokenizer.decode(*UpperCamelCase__						,			**UpperCamelCase__    )







    @contextmanager
    def    snake_case_     (   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_flax_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


__lowerCamelCase						    =      {
    '''configuration_blenderbot''': [
        '''BLENDERBOT_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''BlenderbotConfig''',
        '''BlenderbotOnnxConfig''',
    ],
    '''tokenization_blenderbot''': ['''BlenderbotTokenizer'''],
}

try:
      if not is_tokenizers_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      __lowerCamelCase						    =      ['''BlenderbotTokenizerFast''']

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      __lowerCamelCase						    =      [
          '''BLENDERBOT_PRETRAINED_MODEL_ARCHIVE_LIST''',
          '''BlenderbotForCausalLM''',
          '''BlenderbotForConditionalGeneration''',
          '''BlenderbotModel''',
          '''BlenderbotPreTrainedModel''',
      ]


try:
      if not is_tf_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      __lowerCamelCase						    =      [
          '''TFBlenderbotForConditionalGeneration''',
          '''TFBlenderbotModel''',
          '''TFBlenderbotPreTrainedModel''',
      ]


try:
      if not is_flax_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      __lowerCamelCase						    =      [
          '''FlaxBlenderbotForConditionalGeneration''',
          '''FlaxBlenderbotModel''',
          '''FlaxBlenderbotPreTrainedModel''',
      ]


if TYPE_CHECKING:
      from .configuration_blenderbot import (
          BLENDERBOT_PRETRAINED_CONFIG_ARCHIVE_MAP,
          BlenderbotConfig,
          BlenderbotOnnxConfig,
      )
      from .tokenization_blenderbot import BlenderbotTokenizer

      try:
            if not is_tokenizers_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .tokenization_blenderbot_fast import BlenderbotTokenizerFast

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_blenderbot import (
                BLENDERBOT_PRETRAINED_MODEL_ARCHIVE_LIST,
                BlenderbotForCausalLM,
                BlenderbotForConditionalGeneration,
                BlenderbotModel,
                BlenderbotPreTrainedModel,
            )

      try:
            if not is_tf_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_tf_blenderbot import (
                TFBlenderbotForConditionalGeneration,
                TFBlenderbotModel,
                TFBlenderbotPreTrainedModel,
            )

      try:
            if not is_flax_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_flax_blenderbot import (
                FlaxBlenderbotForConditionalGeneration,
                FlaxBlenderbotModel,
                FlaxBlenderbotPreTrainedModel,
            )

else:
      import sys

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