





import warnings

from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding

class      A       (	__lowercase						):
      _snake_case							     =['''image_processor''', '''tokenizer''']
      _snake_case							     ='''CLIPImageProcessor'''
      _snake_case							     =('''CLIPTokenizer''', '''CLIPTokenizerFast''')



      def __init__(	self:						Union[str, Any]		,  _lowerCAmelCase:						int=None		,  _lowerCAmelCase:						List[Any]=None		,  **_lowerCAmelCase:						Tuple       )						->    str:
         '''simple docstring'''

         UpperCAmelCase_											=None
         if "feature_extractor" in kwargs:
            warnings.warn(
                "The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`"
                " instead."		,  _lowerCAmelCase		,  )
            UpperCAmelCase_											=kwargs.pop("feature_extractor"       )

         UpperCAmelCase_											=image_processor if image_processor is not None else feature_extractor
         if image_processor is None:
            raise ValueError("You need to specify an `image_processor`."       )
         if tokenizer is None:
            raise ValueError("You need to specify a `tokenizer`."       )

         super().__init__(_lowerCAmelCase		,  _lowerCAmelCase       )



      def __call__(	self:						Dict		,  _lowerCAmelCase:						str=None		,  _lowerCAmelCase:						Union[str, Any]=None		,  _lowerCAmelCase:						Tuple=None		,  **_lowerCAmelCase:						str       )						->    Optional[int]:
         '''simple docstring'''

         if text is None and images is None:
            raise ValueError("You have to specify either text or images. Both cannot be none."       )

         if text is not None:
            UpperCAmelCase_											=self.tokenizer(_lowerCAmelCase		,  return_tensors=_lowerCAmelCase		,  **_lowerCAmelCase       )

         if images is not None:
            UpperCAmelCase_											=self.image_processor(_lowerCAmelCase		,  return_tensors=_lowerCAmelCase		,  **_lowerCAmelCase       )

         if text is not None and images is not None:
            UpperCAmelCase_											=image_features.pixel_values
            return encoding
         elif text is not None:
            return encoding
         else:
            return BatchEncoding(data=dict(**_lowerCAmelCase       )		,  tensor_type=_lowerCAmelCase       )



      def 	lowerCAmelCase__    (	self:						List[str]		,  *_lowerCAmelCase:						List[Any]		,  **_lowerCAmelCase:						List[Any]       )						->    Union[str, Any]:
         '''simple docstring'''

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



      def 	lowerCAmelCase__    (	self:						Union[str, Any]		,  *_lowerCAmelCase:						int		,  **_lowerCAmelCase:						str       )						->    str:
         '''simple docstring'''

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



      @property
      def 	lowerCAmelCase__    (	self:						Any       )						->    Tuple:
         '''simple docstring'''

         UpperCAmelCase_											=self.tokenizer.model_input_names
         UpperCAmelCase_											=self.image_processor.model_input_names
         return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names       )       )



      @property
      def 	lowerCAmelCase__    (	self:						int       )						->    Optional[Any]:
         '''simple docstring'''

         warnings.warn(
             "`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead."		,  _lowerCAmelCase		,  )
         return self.image_processor_class






      @property
      def 	lowerCAmelCase__    (	self:						Optional[Any]       )						->    List[Any]:
         '''simple docstring'''

         warnings.warn(
             "`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead."		,  _lowerCAmelCase		,  )
         return self.image_processor











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


__lowercase  :   Optional[int]						      =logging.get_logger(__name__)

__lowercase  :   Union[str, Any]						      ={
    """Visual-Attention-Network/van-base""": (
        """https://huggingface.co/Visual-Attention-Network/van-base/blob/main/config.json"""
    ),
}

class      A       (	__lowercase						):
      _snake_case							     ='''van'''



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

         super().__init__(**_lowerCAmelCase       )
         UpperCAmelCase_											=image_size
         UpperCAmelCase_											=num_channels
         UpperCAmelCase_											=patch_sizes
         UpperCAmelCase_											=strides
         UpperCAmelCase_											=hidden_sizes
         UpperCAmelCase_											=depths
         UpperCAmelCase_											=mlp_ratios
         UpperCAmelCase_											=hidden_act
         UpperCAmelCase_											=initializer_range
         UpperCAmelCase_											=layer_norm_eps
         UpperCAmelCase_											=layer_scale_init_value
         UpperCAmelCase_											=drop_path_rate
         UpperCAmelCase_											=dropout_rate




