


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


A__:   List[str]    =	logging.get_logger(__name__)

A__:   int    =	{
    '''microsoft/mpnet-base''': '''https://huggingface.co/microsoft/mpnet-base/resolve/main/config.json''',
}







class A__	(						lowerCAmelCase__				):
      __UpperCamelCase	:  Optional[Any]     	=							'''mpnet'''






      def __init__(			self      :str					,						SCREAMING_SNAKE_CASE      :Dict=3_0_5_2_7					,						SCREAMING_SNAKE_CASE      :str=7_6_8					,						SCREAMING_SNAKE_CASE      :Optional[int]=1_2					,						SCREAMING_SNAKE_CASE      :List[str]=1_2					,						SCREAMING_SNAKE_CASE      :List[str]=3_0_7_2					,						SCREAMING_SNAKE_CASE      :int="gelu"					,						SCREAMING_SNAKE_CASE      :Optional[Any]=0.1					,						SCREAMING_SNAKE_CASE      :Dict=0.1					,						SCREAMING_SNAKE_CASE      :Optional[Any]=5_1_2					,						SCREAMING_SNAKE_CASE      :int=0.02					,						SCREAMING_SNAKE_CASE      :Dict=1e-12					,						SCREAMING_SNAKE_CASE      :Dict=3_2					,						SCREAMING_SNAKE_CASE      :Any=1					,						SCREAMING_SNAKE_CASE      :str=0					,						SCREAMING_SNAKE_CASE      :Optional[int]=2					,						**SCREAMING_SNAKE_CASE      :int					,						)	-> Any:




             '''simple docstring'''
             super().__init__(pad_token_id=__lowerCAmelCase					,						bos_token_id=__lowerCAmelCase					,						eos_token_id=__lowerCAmelCase					,						**__lowerCAmelCase     )

             _a   :			List[str]					 =vocab_size
             _a   :			List[str]					 =hidden_size
             _a   :			List[str]					 =num_hidden_layers
             _a   :			Optional[Any]					 =num_attention_heads
             _a   :			Optional[int]					 =hidden_act
             _a   :			int					 =intermediate_size
             _a   :			Tuple					 =hidden_dropout_prob
             _a   :			List[str]					 =attention_probs_dropout_prob
             _a   :			Dict					 =max_position_embeddings
             _a   :			Optional[Any]					 =initializer_range
             _a   :			Any					 =layer_norm_eps
             _a   :			List[str]					 =relative_attention_num_buckets






'''simple docstring'''







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







class A__	(						UpperCAmelCase__				):
      __UpperCamelCase	:  Optional[Any]     	=							["image_processor", "tokenizer"]
      __UpperCamelCase	:  Optional[Any]     	=							"EfficientNetImageProcessor"
      __UpperCamelCase	:  Union[str, Any]     	=							("BertTokenizer", "BertTokenizerFast")






      def __init__(			self      :Union[str, Any]					,						SCREAMING_SNAKE_CASE      :int					,						SCREAMING_SNAKE_CASE      :Optional[int]     )	-> List[str]:




             '''simple docstring'''
             super().__init__(SCREAMING_SNAKE_CASE					,						SCREAMING_SNAKE_CASE     )






      def __call__(			self      :str					,						SCREAMING_SNAKE_CASE      :List[Any]=None					,						SCREAMING_SNAKE_CASE      :Dict=None					,						SCREAMING_SNAKE_CASE      :Union[str, Any]="max_length"					,						SCREAMING_SNAKE_CASE      :Any=6_4					,						SCREAMING_SNAKE_CASE      :List[str]=None					,						**SCREAMING_SNAKE_CASE      :Union[str, Any]     )	-> 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:
                    _a   :			Dict					 =self.tokenizer(
                        SCREAMING_SNAKE_CASE					,						padding=SCREAMING_SNAKE_CASE					,						max_length=SCREAMING_SNAKE_CASE					,						return_tensors=SCREAMING_SNAKE_CASE					,						**SCREAMING_SNAKE_CASE     )

             if images is not None:
                    _a   :			Any					 =self.image_processor(SCREAMING_SNAKE_CASE					,						return_tensors=SCREAMING_SNAKE_CASE					,						**SCREAMING_SNAKE_CASE     )

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






      def __UpperCAmelCase	(			self      :Any					,						*SCREAMING_SNAKE_CASE      :Optional[int]					,						**SCREAMING_SNAKE_CASE      :str     )	-> Dict:




             '''simple docstring'''
             return self.tokenizer.batch_decode(*SCREAMING_SNAKE_CASE					,						**SCREAMING_SNAKE_CASE     )






      def __UpperCAmelCase	(			self      :int					,						*SCREAMING_SNAKE_CASE      :List[str]					,						**SCREAMING_SNAKE_CASE      :Union[str, Any]     )	-> Union[str, Any]:




             '''simple docstring'''
             return self.tokenizer.decode(*SCREAMING_SNAKE_CASE					,						**SCREAMING_SNAKE_CASE     )






      @property
      def __UpperCAmelCase	(			self      :Tuple     )	-> Tuple:




             '''simple docstring'''
             _a   :			int					 =self.tokenizer.model_input_names
             _a   :			Union[str, Any]					 =self.image_processor.model_input_names
             return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names     )     )


