




'''simple docstring'''



import warnings
from contextlib import contextmanager

from ....processing_utils import ProcessorMixin




class 		lowercase_   (			UpperCAmelCase__       ):


   """simple docstring"""

   lowerCamelCase_      =						'MCTCTFeatureExtractor'
   lowerCamelCase_      =						'AutoTokenizer'



   def __init__(   self :     Any  ,				__lowerCamelCase :     Any  ,				__lowerCamelCase :     int   ):

      """simple docstring"""
      super().__init__(_SCREAMING_SNAKE_CASE  ,				_SCREAMING_SNAKE_CASE   )
      _SCREAMING_SNAKE_CASE	=				self.feature_extractor
      _SCREAMING_SNAKE_CASE	=				False



   def __call__(   self :     str  ,				*__lowerCamelCase :     List[str]  ,				**__lowerCamelCase :     List[Any]   ):

      """simple docstring"""




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

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

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



   def 							lowerCAmelCase_      (   self :     Dict  ,				*__lowerCamelCase :     Tuple  ,				**__lowerCamelCase :     Dict   ):

      """simple docstring"""
      return self.tokenizer.batch_decode(*_SCREAMING_SNAKE_CASE  ,				**_SCREAMING_SNAKE_CASE   )



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

      """simple docstring"""




      if self._in_target_context_manager:
         return self.current_processor.pad(*_SCREAMING_SNAKE_CASE  ,				**_SCREAMING_SNAKE_CASE   )

      _SCREAMING_SNAKE_CASE	=				kwargs.pop("input_features"  ,				_SCREAMING_SNAKE_CASE   )
      _SCREAMING_SNAKE_CASE	=				kwargs.pop("labels"  ,				_SCREAMING_SNAKE_CASE   )
      if len(_SCREAMING_SNAKE_CASE   ) > 0:
         _SCREAMING_SNAKE_CASE	=				args[0]
         _SCREAMING_SNAKE_CASE	=				args[1:]

      if input_features is not None:
         _SCREAMING_SNAKE_CASE	=				self.feature_extractor.pad(_SCREAMING_SNAKE_CASE  ,				*_SCREAMING_SNAKE_CASE  ,				**_SCREAMING_SNAKE_CASE   )
      if labels is not None:
         _SCREAMING_SNAKE_CASE	=				self.tokenizer.pad(_SCREAMING_SNAKE_CASE  ,				**_SCREAMING_SNAKE_CASE   )

      if labels is None:
         return input_features
      elif input_features is None:
         return labels
      else:
         _SCREAMING_SNAKE_CASE	=				labels["""input_ids"""]
         return input_features



   def 							lowerCAmelCase_      (   self :     List[Any]  ,				*__lowerCamelCase :     Union[str, Any]  ,				**__lowerCamelCase :     Optional[int]   ):

      """simple docstring"""
      return self.tokenizer.decode(*_SCREAMING_SNAKE_CASE  ,				**_SCREAMING_SNAKE_CASE   )



   @contextmanager
   def 							lowerCAmelCase_      (   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."   )
      _SCREAMING_SNAKE_CASE	=				True
      _SCREAMING_SNAKE_CASE	=				self.tokenizer
      yield
      _SCREAMING_SNAKE_CASE	=				self.feature_extractor
      _SCREAMING_SNAKE_CASE	=				False







'''simple docstring'''



from collections import OrderedDict
from typing import List, Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


lowerCamelCase_			=						logging.get_logger(__name__)

lowerCamelCase_			=						{
    'google/efficientnet-b7': 'https://huggingface.co/google/efficientnet-b7/resolve/main/config.json',
}







class 		lowercase_   (			A       ):


   """simple docstring"""

   lowerCamelCase_      =						'''efficientnet'''



   def __init__(   self :     Optional[Any]  ,				__lowerCamelCase :     int = 3  ,				__lowerCamelCase :     int = 6_0_0  ,				__lowerCamelCase :     float = 2.0  ,				__lowerCamelCase :     float = 3.1  ,				__lowerCamelCase :     int = 8  ,				__lowerCamelCase :     List[int] = [3, 3, 5, 3, 5, 5, 3]  ,				__lowerCamelCase :     List[int] = [3_2, 1_6, 2_4, 4_0, 8_0, 1_1_2, 1_9_2]  ,				__lowerCamelCase :     List[int] = [1_6, 2_4, 4_0, 8_0, 1_1_2, 1_9_2, 3_2_0]  ,				__lowerCamelCase :     List[int] = []  ,				__lowerCamelCase :     List[int] = [1, 2, 2, 2, 1, 2, 1]  ,				__lowerCamelCase :     List[int] = [1, 2, 2, 3, 3, 4, 1]  ,				__lowerCamelCase :     List[int] = [1, 6, 6, 6, 6, 6, 6]  ,				__lowerCamelCase :     float = 0.2_5  ,				__lowerCamelCase :     str = "swish"  ,				__lowerCamelCase :     int = 2_5_6_0  ,				__lowerCamelCase :     str = "mean"  ,				__lowerCamelCase :     float = 0.0_2  ,				__lowerCamelCase :     float = 0.0_0_1  ,				__lowerCamelCase :     float = 0.9_9  ,				__lowerCamelCase :     float = 0.5  ,				__lowerCamelCase :     float = 0.2  ,				**__lowerCamelCase :     Tuple  ,				):

      """simple docstring"""
      super().__init__(**__lowerCamelCase   )

      _SCREAMING_SNAKE_CASE	=				num_channels
      _SCREAMING_SNAKE_CASE	=				image_size
      _SCREAMING_SNAKE_CASE	=				width_coefficient
      _SCREAMING_SNAKE_CASE	=				depth_coefficient
      _SCREAMING_SNAKE_CASE	=				depth_divisor
      _SCREAMING_SNAKE_CASE	=				kernel_sizes
      _SCREAMING_SNAKE_CASE	=				in_channels
      _SCREAMING_SNAKE_CASE	=				out_channels
      _SCREAMING_SNAKE_CASE	=				depthwise_padding
      _SCREAMING_SNAKE_CASE	=				strides
      _SCREAMING_SNAKE_CASE	=				num_block_repeats
      _SCREAMING_SNAKE_CASE	=				expand_ratios
      _SCREAMING_SNAKE_CASE	=				squeeze_expansion_ratio
      _SCREAMING_SNAKE_CASE	=				hidden_act
      _SCREAMING_SNAKE_CASE	=				hidden_dim
      _SCREAMING_SNAKE_CASE	=				pooling_type
      _SCREAMING_SNAKE_CASE	=				initializer_range
      _SCREAMING_SNAKE_CASE	=				batch_norm_eps
      _SCREAMING_SNAKE_CASE	=				batch_norm_momentum
      _SCREAMING_SNAKE_CASE	=				dropout_rate
      _SCREAMING_SNAKE_CASE	=				drop_connect_rate
      _SCREAMING_SNAKE_CASE	=				sum(__lowerCamelCase   ) * 4







class 		lowercase_   (			A       ):


   """simple docstring"""

   lowerCamelCase_      =						version.parse('''1.11'''       )



   @property
   def 							lowerCAmelCase_      (   self :     Optional[Any]   ):

      """simple docstring"""
      return OrderedDict(
          [
              ("pixel_values", {0: "batch", 1: "num_channels", 2: "height", 3: "width"}),
          ]   )



   @property
   def 							lowerCAmelCase_      (   self :     List[Any]   ):

      """simple docstring"""
      return 1e-5

