





'''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


lowerCAmelCase_					:    List[Any]      	=			logging.get_logger(__name__)

lowerCAmelCase_					:    Dict      	=			{
    'google/mobilenet_v2_1.4_224': 'https://huggingface.co/google/mobilenet_v2_1.4_224/resolve/main/config.json',
    'google/mobilenet_v2_1.0_224': 'https://huggingface.co/google/mobilenet_v2_1.0_224/resolve/main/config.json',
    'google/mobilenet_v2_0.75_160': 'https://huggingface.co/google/mobilenet_v2_0.75_160/resolve/main/config.json',
    'google/mobilenet_v2_0.35_96': 'https://huggingface.co/google/mobilenet_v2_0.35_96/resolve/main/config.json',
    # See all MobileNetV2 models at https://huggingface.co/models?filter=mobilenet_v2
}
class 				__SCREAMING_SNAKE_CASE  (__a      ):






				"""simple docstring"""







				__a            ="""mobilenet_v2"""




				def __init__(  self     :					List[Any]					,				__a     :					Any=3					,				__a     :					Tuple=2_24					,				__a     :					Dict=1.0					,				__a     :					Union[str, Any]=8					,				__a     :					str=8					,				__a     :					Dict=6					,				__a     :					Dict=32					,				__a     :					Optional[int]=True					,				__a     :					Any=True					,				__a     :					List[Any]="relu6"					,				__a     :					Tuple=True					,				__a     :					Dict=0.8					,				__a     :					int=0.02					,				__a     :					List[Any]=0.001					,				__a     :					Union[str, Any]=2_55					,				**__a     :					List[str]					,				):
								super().__init__(**__a					)

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

								_a								= num_channels
								_a								= image_size
								_a								= depth_multiplier
								_a								= depth_divisible_by
								_a								= min_depth
								_a								= expand_ratio
								_a								= output_stride
								_a								= first_layer_is_expansion
								_a								= finegrained_output
								_a								= hidden_act
								_a								= tf_padding
								_a								= classifier_dropout_prob
								_a								= initializer_range
								_a								= layer_norm_eps
								_a								= semantic_loss_ignore_index


class 				__SCREAMING_SNAKE_CASE  (__a      ):






				"""simple docstring"""







				__a            =version.parse('1.11'      )




				@property
				def   UpperCamelCase__   (  self     :					str					):
								return OrderedDict([("pixel_values", {0: "batch"})]					)




				@property
				def   UpperCamelCase__   (  self     :					Dict					):

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




				@property
				def   UpperCamelCase__   (  self     :					str					):
								return 1e-4






'''simple docstring'''







import warnings

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


class 			_a  (	__a ):
       __a				:     int   				=					["""image_processor""", """tokenizer"""]
       __a				:     Union[str, Any]   				=					"""ChineseCLIPImageProcessor"""
       __a				:     List[Any]   				=					("""BertTokenizer""", """BertTokenizerFast""")
       def __init__(	self						:	Dict   ,				lowercase						:	Union[str, Any]=None   ,				lowercase						:	Dict=None   ,				**lowercase						:	Optional[Any]				):



           '''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.'''   ,				lowercase   ,				)
               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__(lowercase   ,				lowercase				)
           UpperCAmelCase			       =		self.image_processor
       def __call__(	self						:	Tuple   ,				lowercase						:	Optional[Any]=None   ,				lowercase						:	Union[str, Any]=None   ,				lowercase						:	int=None   ,				**lowercase						:	Dict				):



           '''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(lowercase   ,				return_tensors=lowercase   ,				**lowercase				)

           if images is not None:
               UpperCAmelCase			       =		self.image_processor(lowercase   ,				return_tensors=lowercase   ,				**lowercase				)

           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(**lowercase				)   ,				tensor_type=lowercase				)
       def     A      (	self						:	int   ,				*lowercase						:	Tuple   ,				**lowercase						:	List[str]				):



           '''simple docstring'''

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



           '''simple docstring'''

           return self.tokenizer.decode(*lowercase   ,				**lowercase				)
       @property
       def     A      (	self						:	Optional[int]				):



           '''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     A      (	self						:	List[Any]				):



           '''simple docstring'''

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




