


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


A				:   str		= logging.get_logger(__name__)

A				:   List[Any]		= {
    "dandelin/vilt-b32-mlm": "https://huggingface.co/dandelin/vilt-b32-mlm/blob/main/config.json"
}







class       _lowercase			(							lowercase__):


       """simple docstring"""




       A__ 						=      "vilt"





       def __init__(       self							:      Tuple ,				__lowerCamelCase							:      Optional[int]=30522 ,				__lowerCamelCase							:      List[str]=2 ,				__lowerCamelCase							:      Dict=2 ,				__lowerCamelCase							:      Optional[int]=40 ,				__lowerCamelCase							:      int=768 ,				__lowerCamelCase							:      Optional[int]=12 ,				__lowerCamelCase							:      Any=12 ,				__lowerCamelCase							:      Any=3072 ,				__lowerCamelCase							:      Optional[Any]="gelu" ,				__lowerCamelCase							:      Optional[Any]=0.0 ,				__lowerCamelCase							:      Dict=0.0 ,				__lowerCamelCase							:      List[str]=0.0_2 ,				__lowerCamelCase							:      List[str]=1E-1_2 ,				__lowerCamelCase							:      str=384 ,				__lowerCamelCase							:      List[Any]=32 ,				__lowerCamelCase							:      List[str]=3 ,				__lowerCamelCase							:      Any=True ,				__lowerCamelCase							:      Optional[Any]=-1 ,				__lowerCamelCase							:      str=False ,				__lowerCamelCase							:      Optional[Any]=-1 ,				**__lowerCamelCase							:      Union[str, Any] ,				):


             '''simple docstring'''



             super().__init__(tie_word_embeddings=__lowerCamelCase ,				**__lowerCamelCase	)

             lowerCamelCase__		:    str   =  vocab_size
             lowerCamelCase__		:    Union[str, Any]   =  type_vocab_size
             lowerCamelCase__		:    List[Any]   =  modality_type_vocab_size
             lowerCamelCase__		:    str   =  max_position_embeddings

             lowerCamelCase__		:    int   =  hidden_size
             lowerCamelCase__		:    Optional[Any]   =  num_hidden_layers
             lowerCamelCase__		:    Optional[Any]   =  num_attention_heads
             lowerCamelCase__		:    Dict   =  intermediate_size
             lowerCamelCase__		:    Any   =  hidden_act
             lowerCamelCase__		:    Optional[Any]   =  hidden_dropout_prob
             lowerCamelCase__		:    str   =  attention_probs_dropout_prob
             lowerCamelCase__		:    int   =  initializer_range
             lowerCamelCase__		:    str   =  layer_norm_eps

             lowerCamelCase__		:    Optional[int]   =  image_size
             lowerCamelCase__		:    List[Any]   =  patch_size
             lowerCamelCase__		:    Tuple   =  num_channels
             lowerCamelCase__		:    Any   =  qkv_bias
             lowerCamelCase__		:    Any   =  max_image_length
             lowerCamelCase__		:    int   =  num_images






import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin







class       _lowercase			(							lowercase__):


       """simple docstring"""




       A__ 						=      "AutoFeatureExtractor"
       A__ 						=      "Speech2Text2Tokenizer"





       def __init__(       self							:      List[str] ,				__lowerCamelCase							:      Dict ,				__lowerCamelCase							:      str	):


             '''simple docstring'''



             super().__init__(__lowerCamelCase ,				__lowerCamelCase	)
             lowerCamelCase__		:    Optional[Any]   =  self.feature_extractor
             lowerCamelCase__		:    Optional[int]   =  False





       def __call__(       self							:      List[str] ,				*__lowerCamelCase							:      Union[str, Any] ,				**__lowerCamelCase							:      List[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__		:    List[Any]   =  kwargs.pop("raw_speech"	)
             else:
                   lowerCamelCase__		:    str   =  kwargs.pop("audio" ,				__lowerCamelCase	)
             lowerCamelCase__		:    Optional[Any]   =  kwargs.pop("sampling_rate" ,				__lowerCamelCase	)
             lowerCamelCase__		:    Union[str, Any]   =  kwargs.pop("text" ,				__lowerCamelCase	)
             if len(__lowerCamelCase	) > 0:
                   lowerCamelCase__		:    Dict   =  args[0]
                   lowerCamelCase__		:    int   =  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__		:    str   =  self.feature_extractor(__lowerCamelCase ,				*__lowerCamelCase ,				sampling_rate=__lowerCamelCase ,				**__lowerCamelCase	)
             if text is not None:
                   lowerCamelCase__		:    Optional[int]   =  self.tokenizer(__lowerCamelCase ,				**__lowerCamelCase	)

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





       def 						lowerCAmelCase					(       self							:      Any ,				*__lowerCamelCase							:      Any ,				**__lowerCamelCase							:      Any	):


             '''simple docstring'''



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





       def 						lowerCAmelCase					(       self							:      Dict ,				*__lowerCamelCase							:      int ,				**__lowerCamelCase							:      List[str]	):


             '''simple docstring'''



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





       @contextmanager
       def 						lowerCAmelCase					(       self							:      Any	):


             '''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__		:    int   =  True
             lowerCamelCase__		:    List[Any]   =  self.tokenizer
             yield
             lowerCamelCase__		:    Optional[int]   =  self.feature_extractor
             lowerCamelCase__		:    List[str]   =  False


