





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


__A									=				logging.get_logger(__name__)

__A									=				{
    "facebook/vit-mae-base": "https://huggingface.co/facebook/vit-mae-base/resolve/main/config.json",
    # See all ViT MAE models at https://huggingface.co/models?filter=vit-mae
}



class    _SCREAMING_SNAKE_CASE						(	__SCREAMING_SNAKE_CASE    ):







 '''simple docstring'''
 lowercase_		=			"vit_mae"

 def __init__(self				:   int       , UpperCAmelCase_				:   List[Any]=768       , UpperCAmelCase_				:   Optional[Any]=12       , UpperCAmelCase_				:   Tuple=12       , UpperCAmelCase_				:   int=3_072       , UpperCAmelCase_				:   Union[str, Any]="gelu"       , UpperCAmelCase_				:   Union[str, Any]=0.0       , UpperCAmelCase_				:   Tuple=0.0       , UpperCAmelCase_				:   Optional[Any]=0.02       , UpperCAmelCase_				:   List[Any]=1E-1_2       , UpperCAmelCase_				:   Any=224       , UpperCAmelCase_				:   List[str]=16       , UpperCAmelCase_				:   Optional[int]=3       , UpperCAmelCase_				:   List[str]=True       , UpperCAmelCase_				:   Dict=16       , UpperCAmelCase_				:   str=512       , UpperCAmelCase_				:   List[Any]=8       , UpperCAmelCase_				:   List[str]=2_048       , UpperCAmelCase_				:   Dict=0.75       , UpperCAmelCase_				:   Tuple=False       , **UpperCAmelCase_				:   str       , )       ->List[str]:



   '''simple docstring'''



   super().__init__(**UpperCAmelCase_)

   lowerCamelCase__:      Union[str, Any]			  =hidden_size
   lowerCamelCase__:      int			  =num_hidden_layers
   lowerCamelCase__:      str			  =num_attention_heads
   lowerCamelCase__:      int			  =intermediate_size
   lowerCamelCase__:      str			  =hidden_act
   lowerCamelCase__:      Optional[int]			  =hidden_dropout_prob
   lowerCamelCase__:      int			  =attention_probs_dropout_prob
   lowerCamelCase__:      Dict			  =initializer_range
   lowerCamelCase__:      int			  =layer_norm_eps
   lowerCamelCase__:      List[str]			  =image_size
   lowerCamelCase__:      Optional[Any]			  =patch_size
   lowerCamelCase__:      Any			  =num_channels
   lowerCamelCase__:      Optional[Any]			  =qkv_bias
   lowerCamelCase__:      List[str]			  =decoder_num_attention_heads
   lowerCamelCase__:      List[Any]			  =decoder_hidden_size
   lowerCamelCase__:      str			  =decoder_num_hidden_layers
   lowerCamelCase__:      List[Any]			  =decoder_intermediate_size
   lowerCamelCase__:      Optional[int]			  =mask_ratio
   lowerCamelCase__:      Optional[int]			  =norm_pix_loss








'''simple docstring'''
from typing import List, Optional, Union

from ...image_utils import ImageInput
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy
from ...utils import TensorType

class      snake_case     (    __lowerCamelCase       ):




 """simple docstring"""



 SCREAMING_SNAKE_CASE_	:					Any					=["image_processor", "tokenizer"]
 SCREAMING_SNAKE_CASE_	:					List[Any]					="BlipImageProcessor"
 SCREAMING_SNAKE_CASE_	:					Optional[int]					=("BertTokenizer", "BertTokenizerFast")






 def __init__(       self       :							Dict							,	__A       :							Optional[int]							,	__A       :							List[Any]	):
        __UpperCamelCase       =  False
        super().__init__(__A							,	__A	)
        __UpperCamelCase       =  self.image_processor






 def __call__(       self       :							List[Any]							,	__A       :							ImageInput = None							,	__A       :							Union[TextInput, PreTokenizedInput, List[TextInput], List[PreTokenizedInput]] = None							,	__A       :							bool = True							,	__A       :							Union[bool, str, PaddingStrategy] = False							,	__A       :							Union[bool, str, TruncationStrategy] = None							,	__A       :							Optional[int] = None							,	__A       :							int = 0							,	__A       :							Optional[int] = None							,	__A       :							Optional[bool] = None							,	__A       :							bool = False							,	__A       :							bool = False							,	__A       :							bool = False							,	__A       :							bool = False							,	__A       :							bool = False							,	__A       :							bool = True							,	__A       :							Optional[Union[str, TensorType]] = None							,	**__A       :							List[Any]							,	):
        if images is None and text is None:
               raise ValueError('You have to specify either images or text.'	)

        # Get only text
        if images is None:
               __UpperCamelCase       =  self.tokenizer
               __UpperCamelCase       =  self.tokenizer(
                   text=__A							,	add_special_tokens=__A							,	padding=__A							,	truncation=__A							,	max_length=__A							,	stride=__A							,	pad_to_multiple_of=__A							,	return_attention_mask=__A							,	return_overflowing_tokens=__A							,	return_special_tokens_mask=__A							,	return_offsets_mapping=__A							,	return_token_type_ids=__A							,	return_length=__A							,	verbose=__A							,	return_tensors=__A							,	**__A							,	)
               return text_encoding

        # add pixel_values
        __UpperCamelCase       =  self.image_processor(__A							,	return_tensors=__A	)

        if text is not None:
               __UpperCamelCase       =  self.tokenizer(
                   text=__A							,	add_special_tokens=__A							,	padding=__A							,	truncation=__A							,	max_length=__A							,	stride=__A							,	pad_to_multiple_of=__A							,	return_attention_mask=__A							,	return_overflowing_tokens=__A							,	return_special_tokens_mask=__A							,	return_offsets_mapping=__A							,	return_token_type_ids=__A							,	return_length=__A							,	verbose=__A							,	return_tensors=__A							,	**__A							,	)
        else:
               __UpperCamelCase       =  None

        if text_encoding is not None:
               encoding_image_processor.update(__A	)

        return encoding_image_processor






 def        _lowerCamelCase					(       self       :							List[Any]							,	*__A       :							Dict							,	**__A       :							Optional[int]	):
        return self.tokenizer.batch_decode(*__A							,	**__A	)






 def        _lowerCamelCase					(       self       :							List[Any]							,	*__A       :							List[str]							,	**__A       :							Dict	):
        return self.tokenizer.decode(*__A							,	**__A	)






 @property
 def        _lowerCamelCase					(       self       :							Tuple	):
        __UpperCamelCase       =  self.tokenizer.model_input_names
        __UpperCamelCase       =  self.image_processor.model_input_names
        return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names	)	)
