
"""simple docstring"""





from ...configuration_utils import PretrainedConfig
from ...utils import logging


_a		       =							logging.get_logger(__name__)

_a		       =							{
    'alibaba-damo/mgp-str-base': 'https://huggingface.co/alibaba-damo/mgp-str-base/resolve/main/config.json',
}


class A_	(lowercase__      ):




  '''simple docstring'''
  SCREAMING_SNAKE_CASE__			:						Tuple       =		"""mgp-str"""







  def __init__(		self				,   lowercase_=[32, 128]				,   lowercase_=4				,   lowercase_=3				,   lowercase_=27				,   lowercase_=38				,   lowercase_=5_0257				,   lowercase_=3_0522				,   lowercase_=768				,   lowercase_=12				,   lowercase_=12				,   lowercase_=4.0				,   lowercase_=True				,   lowercase_=False				,   lowercase_=1E-5				,   lowercase_=0.0				,   lowercase_=0.0				,   lowercase_=0.0				,   lowercase_=False				,   lowercase_=0.02				,   **lowercase_				,   ):

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

     UpperCAmelCase_					:					List[str]			     =    image_size
     UpperCAmelCase_					:					int			     =    patch_size
     UpperCAmelCase_					:					Tuple			     =    num_channels
     UpperCAmelCase_					:					Dict			     =    max_token_length
     UpperCAmelCase_					:					Optional[int]			     =    num_character_labels
     UpperCAmelCase_					:					Optional[int]			     =    num_bpe_labels
     UpperCAmelCase_					:					Optional[int]			     =    num_wordpiece_labels
     UpperCAmelCase_					:					Optional[int]			     =    hidden_size
     UpperCAmelCase_					:					int			     =    num_hidden_layers
     UpperCAmelCase_					:					List[str]			     =    num_attention_heads
     UpperCAmelCase_					:					str			     =    mlp_ratio
     UpperCAmelCase_					:					Any			     =    distilled
     UpperCAmelCase_					:					Union[str, Any]			     =    layer_norm_eps
     UpperCAmelCase_					:					Dict			     =    drop_rate
     UpperCAmelCase_					:					str			     =    qkv_bias
     UpperCAmelCase_					:					Tuple			     =    attn_drop_rate
     UpperCAmelCase_					:					List[Any]			     =    drop_path_rate
     UpperCAmelCase_					:					Optional[Any]			     =    output_aa_attentions
     UpperCAmelCase_					:					List[str]			     =    initializer_range







'''simple docstring'''





import warnings
from contextlib import contextmanager

from ....processing_utils import ProcessorMixin






class __A			(  A						):



 '''simple docstring'''







 __lowerCamelCase    :       Optional[Any]          =       'MCTCTFeatureExtractor'
 __lowerCamelCase    :       Optional[Any]          =       'AutoTokenizer'



 def __init__(self ,   A ,   A       )    ->     Dict:


      """simple docstring"""



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



 def __call__(self ,   *A ,   **A       )    ->     Optional[int]:


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

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



 def 					a__  (self ,   *A ,   **A       )    ->     int:


      """simple docstring"""



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



 def 					a__  (self ,   *A ,   **A       )    ->     Tuple:


      """simple docstring"""



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

      _a      =  kwargs.pop('''input_features''' ,   A       )
      _a      =  kwargs.pop('''labels''' ,   A       )
      if len(A       ) > 0:
           _a      =  args[0]
           _a      =  args[1:]

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

      if labels is None:
           return input_features
      elif input_features is None:
           return labels
      else:
           _a      =  labels['''input_ids''']
           return input_features



 def 					a__  (self ,   *A ,   **A       )    ->     List[str]:


      """simple docstring"""



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



 @contextmanager
 def 					a__  (self       )    ->     Dict:


      """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



