




"""simple docstring"""



from collections import OrderedDict
from typing import Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


SCREAMING_SNAKE_CASE    =	logging.get_logger(__name__)

SCREAMING_SNAKE_CASE    =	{
    "google/mobilenet_v1_1.0_224": "https://huggingface.co/google/mobilenet_v1_1.0_224/resolve/main/config.json",
    "google/mobilenet_v1_0.75_192": "https://huggingface.co/google/mobilenet_v1_0.75_192/resolve/main/config.json",
    # See all MobileNetV1 models at https://huggingface.co/models?filter=mobilenet_v1
}




class      UpperCAmelCase_  (						A_							):
    lowercase__						 =				'''mobilenet_v1'''




    def __init__(   self						:	int     ,			snake_case_						:	Union[str, Any]=3     ,			snake_case_						:	Tuple=224     ,			snake_case_						:	Optional[int]=1.0     ,			snake_case_						:	Optional[int]=8     ,			snake_case_						:	List[Any]="relu6"     ,			snake_case_						:	Optional[Any]=True     ,			snake_case_						:	str=0.999     ,			snake_case_						:	Tuple=0.02     ,			snake_case_						:	Optional[int]=0.001     ,			**snake_case_						:	Optional[Any]     ,			)				->							Any:




     '''simple docstring'''

     super().__init__(**snake_case_				)

     if depth_multiplier <= 0:
      raise ValueError("depth_multiplier must be greater than zero."				)

     A__	=    num_channels
     A__	=    image_size
     A__	=    depth_multiplier
     A__	=    min_depth
     A__	=    hidden_act
     A__	=    tf_padding
     A__	=    classifier_dropout_prob
     A__	=    initializer_range
     A__	=    layer_norm_eps






class      UpperCAmelCase_  (						A_							):
    lowercase__						 =				version.parse('''1.11'''							)




    @property
    def 							__magic_name__							(   self						:	Tuple				)				->							Mapping[str, Mapping[int, str]]:




     '''simple docstring'''

     return OrderedDict([("pixel_values", {0: "batch"})]				)




    @property
    def 							__magic_name__							(   self						:	Any				)				->							Mapping[str, Mapping[int, str]]:




     '''simple docstring'''

     if self.task == "image-classification":
      return OrderedDict([("logits", {0: "batch"})]				)
     else:
      return OrderedDict([("last_hidden_state", {0: "batch"}), ("pooler_output", {0: "batch"})]				)




    @property
    def 							__magic_name__							(   self						:	List[str]				)				->							float:




     '''simple docstring'''

     return 1e-4











"""simple docstring"""



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




class      UpperCAmelCase_  (						A_							):
    lowercase__						 =				['''image_processor''', '''tokenizer''']
    lowercase__						 =				'''AutoImageProcessor'''
    lowercase__						 =				'''AutoTokenizer'''




    def __init__(   self						:	str     ,			snake_case_						:	Dict     ,			snake_case_						:	List[str]				)				->							str:




     '''simple docstring'''

     super().__init__(snake_case_     ,			snake_case_				)
     A__	=    self.image_processor




    def __call__(   self						:	int     ,			snake_case_						:	Any=None     ,			snake_case_						:	Any=None     ,			snake_case_						:	Union[str, Any]=None     ,			**snake_case_						:	Optional[int]				)				->							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__	=    self.tokenizer(snake_case_     ,			return_tensors=snake_case_     ,			**snake_case_				)

     if images is not None:
      A__	=    self.image_processor(snake_case_     ,			return_tensors=snake_case_     ,			**snake_case_				)

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




    def 							__magic_name__							(   self						:	Optional[int]     ,			*snake_case_						:	Union[str, Any]     ,			**snake_case_						:	List[Any]				)				->							int:




     '''simple docstring'''

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




    def 							__magic_name__							(   self						:	List[str]     ,			*snake_case_						:	List[str]     ,			**snake_case_						:	Optional[int]				)				->							Tuple:




     '''simple docstring'''

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




    @property
    def 							__magic_name__							(   self						:	List[Any]				)				->							List[Any]:




     '''simple docstring'''

     return ["input_ids", "attention_mask", "pixel_values"]





