






'''simple docstring'''





import warnings
from contextlib import contextmanager

from ....processing_utils import ProcessorMixin
class 				lowercase       (							_lowerCamelCase      ):


    '''simple docstring'''

    lowerCAmelCase__      				=							"MCTCTFeatureExtractor"
    lowerCAmelCase__      				=							"AutoTokenizer"

    def __init__(					self     :     Dict				,     __lowerCamelCase     :     Any				,     __lowerCamelCase     :     Dict     )							->							Any:

     '''simple docstring'''




     super().__init__(__lowerCamelCase				,     __lowerCamelCase     )
     lowerCamelCase__  =     self.feature_extractor
     lowerCamelCase__  =     False

    def __call__(					self     :     int				,     *__lowerCamelCase     :     List[Any]				,     **__lowerCamelCase     :     Tuple     )							->							Optional[Any]:

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

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

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

     '''simple docstring'''




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

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

     '''simple docstring'''




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

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

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

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

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

     '''simple docstring'''




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




    @contextmanager
    def    a__				(					self     :     Any     )							->							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."     )
     lowerCamelCase__  =     True
     lowerCamelCase__  =     self.tokenizer
     yield
     lowerCamelCase__  =     self.feature_extractor
     lowerCamelCase__  =     False










'''simple docstring'''





from collections import OrderedDict
from typing import Mapping

from packaging import version

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


__A							:							Optional[Any]  							=		logging.get_logger(__name__)

__A							:							int  							=		{
    """google/vit-base-patch16-224""": """https://huggingface.co/vit-base-patch16-224/resolve/main/config.json""",
    # See all ViT models at https://huggingface.co/models?filter=vit
}
class 				lowercase       (							_lowerCamelCase      ):


    '''simple docstring'''

    lowerCAmelCase__      				=							"vit"

    def __init__(					self     :     Optional[int]				,     __lowerCamelCase     :     Tuple=768				,     __lowerCamelCase     :     Tuple=12				,     __lowerCamelCase     :     Tuple=12				,     __lowerCamelCase     :     int=3072				,     __lowerCamelCase     :     Optional[Any]="gelu"				,     __lowerCamelCase     :     Optional[int]=0.0				,     __lowerCamelCase     :     Tuple=0.0				,     __lowerCamelCase     :     Optional[Any]=0.0_2				,     __lowerCamelCase     :     int=1E-12				,     __lowerCamelCase     :     Tuple=224				,     __lowerCamelCase     :     int=16				,     __lowerCamelCase     :     Optional[int]=3				,     __lowerCamelCase     :     List[str]=True				,     __lowerCamelCase     :     str=16				,     **__lowerCamelCase     :     Optional[int]				,     )							->							str:

     '''simple docstring'''




     super().__init__(**__lowerCamelCase     )

     lowerCamelCase__  =     hidden_size
     lowerCamelCase__  =     num_hidden_layers
     lowerCamelCase__  =     num_attention_heads
     lowerCamelCase__  =     intermediate_size
     lowerCamelCase__  =     hidden_act
     lowerCamelCase__  =     hidden_dropout_prob
     lowerCamelCase__  =     attention_probs_dropout_prob
     lowerCamelCase__  =     initializer_range
     lowerCamelCase__  =     layer_norm_eps
     lowerCamelCase__  =     image_size
     lowerCamelCase__  =     patch_size
     lowerCamelCase__  =     num_channels
     lowerCamelCase__  =     qkv_bias
     lowerCamelCase__  =     encoder_stride
class 				lowercase       (							_lowerCamelCase      ):


    '''simple docstring'''

    lowerCAmelCase__      				=							version.parse("1.11"      )

    @property
    def    a__				(					self     :     Optional[int]     )							->							Mapping[str, Mapping[int, str]]:

     '''simple docstring'''




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




    @property
    def    a__				(					self     :     Optional[int]     )							->							float:

     '''simple docstring'''




     return 1E-4

