'''simple docstring'''





import warnings
from contextlib import contextmanager

from ....processing_utils import ProcessorMixin




class 			__A (					UpperCamelCase__      ):
    a__			:		int			  =    """MCTCTFeatureExtractor"""
    a__			:		int			  =    """AutoTokenizer"""



    def __init__(self       :       Dict  ,     __a       :       Tuple  ,     __a       :       Optional[Any]					):
         super().__init__(__a  ,     __a					)
         UpperCAmelCase_			       =  self.feature_extractor
         UpperCAmelCase_			       =  False



    def __call__(self       :       Dict  ,     *__a       :       int  ,     **__a       :       str					):
         # For backward compatibility
         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    _lowercase		(self       :       List[Any]  ,     *__a       :       List[Any]  ,     **__a       :       int					):
         return self.tokenizer.batch_decode(*__a  ,     **__a					)



    def    _lowercase		(self       :       Optional[int]  ,     *__a       :       str  ,     **__a       :       List[Any]					):
         # For backward compatibility
         if self._in_target_context_manager:
              return self.current_processor.pad(*__a  ,     **__a					)

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

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

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



    def    _lowercase		(self       :       Optional[int]  ,     *__a       :       List[Any]  ,     **__a       :       Tuple					):
         return self.tokenizer.decode(*__a  ,     **__a					)






    @contextmanager
    def    _lowercase		(self       :       Any					):
         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 ....configuration_utils import PretrainedConfig
from ....utils import logging


snake_case									=    logging.get_logger(__name__)

snake_case									=    {
    """Visual-Attention-Network/van-base""": (
        """https://huggingface.co/Visual-Attention-Network/van-base/blob/main/config.json"""
    ),
}




class    lowerCAmelCase       (     UpperCamelCase_  ):
 A_				:				Tuple	=			"""van"""


 def __init__(    self  : List[Any]			,							a__  : Dict=224			,							a__  : Dict=3			,							a__  : Union[str, Any]=[7, 3, 3, 3]			,							a__  : Optional[Any]=[4, 2, 2, 2]			,							a__  : Optional[Any]=[64, 128, 320, 512]			,							a__  : List[str]=[3, 3, 12, 3]			,							a__  : Any=[8, 8, 4, 4]			,							a__  : Optional[int]="gelu"			,							a__  : List[Any]=0.02			,							a__  : Tuple=1e-6			,							a__  : List[str]=1e-2			,							a__  : List[str]=0.0			,							a__  : List[Any]=0.0			,							**a__  : Tuple			,							):
  '''simple docstring'''

  super().__init__(**a__    )
  lowerCAmelCase__     :   Any     		=	image_size
  lowerCAmelCase__     :   Tuple     		=	num_channels
  lowerCAmelCase__     :   List[Any]     		=	patch_sizes
  lowerCAmelCase__     :   Dict     		=	strides
  lowerCAmelCase__     :   List[str]     		=	hidden_sizes
  lowerCAmelCase__     :   Union[str, Any]     		=	depths
  lowerCAmelCase__     :   Tuple     		=	mlp_ratios
  lowerCAmelCase__     :   Optional[Any]     		=	hidden_act
  lowerCAmelCase__     :   Dict     		=	initializer_range
  lowerCAmelCase__     :   int     		=	layer_norm_eps
  lowerCAmelCase__     :   Optional[Any]     		=	layer_scale_init_value
  lowerCAmelCase__     :   List[str]     		=	drop_path_rate
  lowerCAmelCase__     :   Any     		=	dropout_rate





