


'''simple docstring'''







import warnings

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






class 		_snake_case    (				snake_case_		):






						'''simple docstring'''







						__snake_case   =      ["image_processor", "tokenizer"]
						__snake_case   =      "AutoImageProcessor"
						__snake_case   =      "AutoTokenizer"







						def __init__(  self:	Tuple      ,							__UpperCamelCase:	Union[str, Any]=None      ,							__UpperCamelCase:	str=None      ,							**__UpperCamelCase:	str     )							->	Tuple:
										__magic_name__				:					Optional[int]						       =       None
										if "feature_extractor" in kwargs:
														warnings.warn(
														    "The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`"
														    " instead."      ,							__UpperCamelCase      ,							)
														__magic_name__				:					List[Any]						       =       kwargs.pop("feature_extractor"     )

										__magic_name__				:					str						       =       image_processor if image_processor is not None else feature_extractor
										if image_processor is None:
														raise ValueError("You have to specify an image_processor."     )
										if tokenizer is None:
														raise ValueError("You have to specify a tokenizer."     )

										super().__init__(__UpperCamelCase      ,							__UpperCamelCase     )
										__magic_name__				:					List[Any]						       =       self.image_processor







						def __call__(  self:	List[str]      ,							__UpperCamelCase:	Optional[Any]=None      ,							__UpperCamelCase:	Dict=None      ,							__UpperCamelCase:	Union[str, Any]=None      ,							**__UpperCamelCase:	Any     )							->	List[Any]:

										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:
														__magic_name__				:					Tuple						       =       self.tokenizer(__UpperCamelCase      ,							return_tensors=__UpperCamelCase      ,							**__UpperCamelCase     )

										if images is not None:
														__magic_name__				:					Optional[Any]						       =       self.image_processor(__UpperCamelCase      ,							return_tensors=__UpperCamelCase      ,							**__UpperCamelCase     )

										if text is not None and images is not None:
														__magic_name__				:					List[Any]						       =       image_features.pixel_values
														return encoding
										elif text is not None:
														return encoding
										else:
														return BatchEncoding(data=dict(**__UpperCamelCase     )      ,							tensor_type=__UpperCamelCase     )







						def lowerCAmelCase__ (  self:	Tuple      ,							*__UpperCamelCase:	Dict      ,							**__UpperCamelCase:	Any     )							->	Dict:
										return self.tokenizer.batch_decode(*__UpperCamelCase      ,							**__UpperCamelCase     )







						def lowerCAmelCase__ (  self:	List[str]      ,							*__UpperCamelCase:	str      ,							**__UpperCamelCase:	List[str]     )							->	List[Any]:
										return self.tokenizer.decode(*__UpperCamelCase      ,							**__UpperCamelCase     )







						@property
						def lowerCAmelCase__ (  self:	Dict     )							->	Optional[Any]:
										__magic_name__				:					Any						       =       self.tokenizer.model_input_names
										__magic_name__				:					int						       =       self.image_processor.model_input_names
										return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names     )     )







						@property
						def lowerCAmelCase__ (  self:	Dict     )							->	Any:
										warnings.warn(
										    "`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead."      ,							__UpperCamelCase      ,							)
										return self.image_processor_class







						@property
						def lowerCAmelCase__ (  self:	int     )							->	List[str]:
										warnings.warn(
										    "`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead."      ,							__UpperCamelCase      ,							)
										return self.image_processor



'''simple docstring'''







def 						_UpperCamelCase							( UpperCamelCase__		):






				"""simple docstring"""



				if not isinstance(UpperCamelCase__     ,   UpperCamelCase__		) or number < 0:
								raise ValueError("Input must be a non-negative integer"		)

				__magic_name__				:					str						       =       number & ~(number - 1)
				__magic_name__				:					Optional[int]						       =       0
				while intermediate:
								intermediate >>= 1
								index += 1
				return index - 1


if __name__ == "__main__":
		import doctest

		doctest.testmod(verbose=True)