


'''simple docstring'''



import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin






class 	UpperCamelCase__(       __lowercase	):
    __magic_name__    :				Union[str, Any]  		=	"Speech2TextFeatureExtractor"
    __magic_name__    :				Dict  		=	"Speech2TextTokenizer"




    def __init__(		self      :			Union[str, Any]				,   lowerCAmelCase      :			Union[str, Any]				,   lowerCAmelCase      :			Optional[int]				)->					List[str]:

          """simple docstring"""




          super().__init__(_a				,   _a				)
          UpperCAmelCase					    =     self.feature_extractor
          UpperCAmelCase					    =     False




    def __call__(		self      :			Dict				,   *lowerCAmelCase      :			Optional[Any]				,   **lowerCAmelCase      :			Optional[int]				)->					Any:

          """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.'''				)
                UpperCAmelCase					    =     kwargs.pop('''raw_speech'''				)
          else:
                UpperCAmelCase					    =     kwargs.pop('''audio'''				,   _a				)
          UpperCAmelCase					    =     kwargs.pop('''sampling_rate'''				,   _a				)
          UpperCAmelCase					    =     kwargs.pop('''text'''				,   _a				)
          if len(_a				) > 0:
                UpperCAmelCase					    =     args[0]
                UpperCAmelCase					    =     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					    =     self.feature_extractor(_a				,   *_a				,   sampling_rate=_a				,   **_a				)
          if text is not None:
                UpperCAmelCase					    =     self.tokenizer(_a				,   **_a				)

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




    def 					a__(		self      :			Tuple				,   *lowerCAmelCase      :			Union[str, Any]				,   **lowerCAmelCase      :			Union[str, Any]				)->					Any:

          """simple docstring"""




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




    def 					a__(		self      :			Union[str, Any]				,   *lowerCAmelCase      :			List[Any]				,   **lowerCAmelCase      :			int				)->					List[str]:

          """simple docstring"""




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





    @contextmanager
    def 					a__(		self      :			Dict				)->					Optional[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.'''				)
          UpperCAmelCase					    =     True
          UpperCAmelCase					    =     self.tokenizer
          yield
          UpperCAmelCase					    =     self.feature_extractor
          UpperCAmelCase					    =     False









'''simple docstring'''



from .data_collator import (
    DataCollatorForLanguageModeling,
    DataCollatorForPermutationLanguageModeling,
    DataCollatorForSeqaSeq,
    DataCollatorForSOP,
    DataCollatorForTokenClassification,
    DataCollatorForWholeWordMask,
    DataCollatorWithPadding,
    DefaultDataCollator,
    default_data_collator,
)
from .metrics import glue_compute_metrics, xnli_compute_metrics
from .processors import (
    DataProcessor,
    InputExample,
    InputFeatures,
    SingleSentenceClassificationProcessor,
    SquadExample,
    SquadFeatures,
    SquadVaProcessor,
    SquadVaProcessor,
    glue_convert_examples_to_features,
    glue_output_modes,
    glue_processors,
    glue_tasks_num_labels,
    squad_convert_examples_to_features,
    xnli_output_modes,
    xnli_processors,
    xnli_tasks_num_labels,
)





