






import warnings
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     _SCREAMING_SNAKE_CASE       (			_a      ):
	snake_case__							:     Union[str, Any]     	=  ["""image_processor""", """tokenizer"""]
	snake_case__							:     Optional[Any]     	=  """FlavaImageProcessor"""
	snake_case__							:     List[str]     	=  ("""BertTokenizer""", """BertTokenizerFast""")





	def __init__(		self				:					List[Any] ,  __lowerCamelCase				:					List[str]=None ,  __lowerCamelCase				:					Dict=None ,  **__lowerCamelCase				:					Tuple	):
		UpperCamelCase     :Union[str, Any]          =	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     :List[Any]          =	kwargs.pop("""feature_extractor"""	)

		UpperCamelCase     :int          =	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	)
		UpperCamelCase     :Optional[int]          =	self.image_processor





	def __call__(		self				:					Optional[Any] ,  __lowerCamelCase				:					Optional[ImageInput] = None ,  __lowerCamelCase				:					Optional[Union[TextInput, PreTokenizedInput, List[TextInput], List[PreTokenizedInput]]] = None ,  __lowerCamelCase				:					bool = True ,  __lowerCamelCase				:					Union[bool, str, PaddingStrategy] = False ,  __lowerCamelCase				:					Union[bool, str, TruncationStrategy] = False ,  __lowerCamelCase				:					Optional[int] = None ,  __lowerCamelCase				:					int = 0 ,  __lowerCamelCase				:					Optional[int] = None ,  __lowerCamelCase				:					Optional[bool] = None ,  __lowerCamelCase				:					Optional[bool] = None ,  __lowerCamelCase				:					Optional[bool] = None ,  __lowerCamelCase				:					Optional[bool] = None ,  __lowerCamelCase				:					bool = False ,  __lowerCamelCase				:					bool = False ,  __lowerCamelCase				:					bool = False ,  __lowerCamelCase				:					bool = False ,  __lowerCamelCase				:					bool = True ,  __lowerCamelCase				:					Optional[Union[str, TensorType]] = None ,  **__lowerCamelCase				:					int ,  ):

		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     :List[str]          =	self.tokenizer(
			    text=__lowerCamelCase ,  add_special_tokens=__lowerCamelCase ,  padding=__lowerCamelCase ,  truncation=__lowerCamelCase ,  max_length=__lowerCamelCase ,  stride=__lowerCamelCase ,  pad_to_multiple_of=__lowerCamelCase ,  return_token_type_ids=__lowerCamelCase ,  return_attention_mask=__lowerCamelCase ,  return_overflowing_tokens=__lowerCamelCase ,  return_special_tokens_mask=__lowerCamelCase ,  return_offsets_mapping=__lowerCamelCase ,  return_length=__lowerCamelCase ,  verbose=__lowerCamelCase ,  return_tensors=__lowerCamelCase ,  **__lowerCamelCase ,  )
		if images is not None:
			UpperCamelCase     :Dict          =	self.image_processor(
			    __lowerCamelCase ,  return_image_mask=__lowerCamelCase ,  return_codebook_pixels=__lowerCamelCase ,  return_tensors=__lowerCamelCase ,  **__lowerCamelCase ,  )

		if text is not None and images is not None:
			encoding.update(__lowerCamelCase	)
			return encoding
		elif text is not None:
			return encoding
		else:
			return BatchEncoding(data=dict(**__lowerCamelCase	) ,  tensor_type=__lowerCamelCase	)





	def 						_A (		self				:					Any ,  *__lowerCamelCase				:					int ,  **__lowerCamelCase				:					Optional[int]	):
		return self.tokenizer.batch_decode(*__lowerCamelCase ,  **__lowerCamelCase	)





	def 						_A (		self				:					Union[str, Any] ,  *__lowerCamelCase				:					Dict ,  **__lowerCamelCase				:					List[str]	):
		return self.tokenizer.decode(*__lowerCamelCase ,  **__lowerCamelCase	)





	@property
	def 						_A (		self				:					Tuple	):
		UpperCamelCase     :Optional[Any]          =	self.tokenizer.model_input_names
		UpperCamelCase     :Any          =	self.image_processor.model_input_names
		return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names	)	)





	@property
	def 						_A (		self				:					Optional[Any]	):
		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 						_A (		self				:					List[Any]	):
		warnings.warn(
		    """`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead.""" ,  __lowerCamelCase ,  )
		return self.image_processor







from typing import List

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


SCREAMING_SNAKE_CASE_						   =       logging.get_logger(__name__)

SCREAMING_SNAKE_CASE_						   =       {
    """snap-research/efficientformer-l1-300""": (
        """https://huggingface.co/snap-research/efficientformer-l1-300/resolve/main/config.json"""
    ),
}

class 		UpperCamelCase__ (      lowerCAmelCase_   ):



     '''simple docstring'''

     __snake_case    :	int			=			"efficientformer"






     def __init__(							self						:    Optional[int]						,lowerCamelCase__						:    List[int] = [3, 2, 6, 4]						,lowerCamelCase__						:    List[int] = [48, 96, 224, 448]						,lowerCamelCase__						:    List[bool] = [True, True, True, True]						,lowerCamelCase__						:    int = 448						,lowerCamelCase__						:    int = 32						,lowerCamelCase__						:    int = 4						,lowerCamelCase__						:    int = 7						,lowerCamelCase__						:    int = 5						,lowerCamelCase__						:    int = 8						,lowerCamelCase__						:    int = 4						,lowerCamelCase__						:    float = 0.0						,lowerCamelCase__						:    int = 16						,lowerCamelCase__						:    int = 3						,lowerCamelCase__						:    int = 3						,lowerCamelCase__						:    int = 3						,lowerCamelCase__						:    int = 2						,lowerCamelCase__						:    int = 1						,lowerCamelCase__						:    float = 0.0						,lowerCamelCase__						:    int = 1						,lowerCamelCase__						:    bool = True						,lowerCamelCase__						:    bool = True						,lowerCamelCase__						:    float = 1e-5						,lowerCamelCase__						:    str = "gelu"						,lowerCamelCase__						:    float = 0.02						,lowerCamelCase__						:    float = 1e-1_2						,lowerCamelCase__						:    int = 224						,lowerCamelCase__						:    float = 1e-0_5						,**lowerCamelCase__						:    str						,)     ->		None:




           '''simple docstring'''


           super().__init__(**lowerCamelCase__       )

           SCREAMING_SNAKE_CASE		=						hidden_act
           SCREAMING_SNAKE_CASE		=						hidden_dropout_prob
           SCREAMING_SNAKE_CASE		=						hidden_sizes
           SCREAMING_SNAKE_CASE		=						num_hidden_layers
           SCREAMING_SNAKE_CASE		=						num_attention_heads
           SCREAMING_SNAKE_CASE		=						initializer_range
           SCREAMING_SNAKE_CASE		=						layer_norm_eps
           SCREAMING_SNAKE_CASE		=						patch_size
           SCREAMING_SNAKE_CASE		=						num_channels
           SCREAMING_SNAKE_CASE		=						depths
           SCREAMING_SNAKE_CASE		=						mlp_expansion_ratio
           SCREAMING_SNAKE_CASE		=						downsamples
           SCREAMING_SNAKE_CASE		=						dim
           SCREAMING_SNAKE_CASE		=						key_dim
           SCREAMING_SNAKE_CASE		=						attention_ratio
           SCREAMING_SNAKE_CASE		=						resolution
           SCREAMING_SNAKE_CASE		=						pool_size
           SCREAMING_SNAKE_CASE		=						downsample_patch_size
           SCREAMING_SNAKE_CASE		=						downsample_stride
           SCREAMING_SNAKE_CASE		=						downsample_pad
           SCREAMING_SNAKE_CASE		=						drop_path_rate
           SCREAMING_SNAKE_CASE		=						num_metaad_blocks
           SCREAMING_SNAKE_CASE		=						distillation
           SCREAMING_SNAKE_CASE		=						use_layer_scale
           SCREAMING_SNAKE_CASE		=						layer_scale_init_value
           SCREAMING_SNAKE_CASE		=						image_size
           SCREAMING_SNAKE_CASE		=						batch_norm_eps


