






"""simple docstring"""



import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin




class        __lowercase(       _UpperCamelCase  ):
						lowerCAmelCase_		:							str=       ["""image_processor""", """tokenizer"""]
						lowerCAmelCase_		:							str=       """AutoImageProcessor"""
						lowerCAmelCase_		:							int=       """AutoTokenizer"""






						def __init__(					self    ,						_SCREAMING_SNAKE_CASE=None    ,						_SCREAMING_SNAKE_CASE=None    ,						**_SCREAMING_SNAKE_CASE)			->  List[str]:




											"""simple docstring"""





											lowerCamelCase__				=None
											if "feature_extractor" in kwargs:
																warnings.warn(
																    'The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`'
																    ' instead.'    ,						_SCREAMING_SNAKE_CASE    ,						)
																lowerCamelCase__				=kwargs.pop('feature_extractor')

											lowerCamelCase__				=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__(_SCREAMING_SNAKE_CASE    ,						_SCREAMING_SNAKE_CASE)
											lowerCamelCase__				=self.image_processor
											lowerCamelCase__				=False






						def __call__(					self    ,						*_SCREAMING_SNAKE_CASE    ,						**_SCREAMING_SNAKE_CASE)			->  List[str]:




											"""simple docstring"""





											if self._in_target_context_manager:
																return self.current_processor(*_SCREAMING_SNAKE_CASE    ,						**_SCREAMING_SNAKE_CASE)

											lowerCamelCase__				=kwargs.pop('images'    ,						_SCREAMING_SNAKE_CASE)
											lowerCamelCase__				=kwargs.pop('text'    ,						_SCREAMING_SNAKE_CASE)
											if len(_SCREAMING_SNAKE_CASE) > 0:
																lowerCamelCase__				=args[0]
																lowerCamelCase__				=args[1:]

											if images is None and text is None:
																raise ValueError('You need to specify either an `images` or `text` input to process.')

											if images is not None:
																lowerCamelCase__				=self.image_processor(_SCREAMING_SNAKE_CASE    ,						*_SCREAMING_SNAKE_CASE    ,						**_SCREAMING_SNAKE_CASE)
											if text is not None:
																lowerCamelCase__				=self.tokenizer(_SCREAMING_SNAKE_CASE    ,						**_SCREAMING_SNAKE_CASE)

											if text is None:
																return inputs
											elif images is None:
																return encodings
											else:
																lowerCamelCase__				=encodings['input_ids']
																return inputs






						def 		lowerCAmelCase   (					self    ,						*_SCREAMING_SNAKE_CASE    ,						**_SCREAMING_SNAKE_CASE)			->  Any:




											"""simple docstring"""





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






						def 		lowerCAmelCase   (					self    ,						*_SCREAMING_SNAKE_CASE    ,						**_SCREAMING_SNAKE_CASE)			->  str:




											"""simple docstring"""





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






						@contextmanager
						def 		lowerCAmelCase   (					self)			->  Union[str, Any]:




											"""simple docstring"""





											warnings.warn(
											    '`as_target_processor` is deprecated and will be removed in v5 of Transformers. You can process your '
											    'labels by using the argument `text` of the regular `__call__` method (either in the same call as '
											    'your images inputs, or in a separate call.')
											lowerCamelCase__				=True
											lowerCamelCase__				=self.tokenizer
											yield
											lowerCamelCase__				=self.image_processor
											lowerCamelCase__				=False






						@property
						def 		lowerCAmelCase   (					self)			->  Any:




											"""simple docstring"""





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






						@property
						def 		lowerCAmelCase   (					self)			->  Dict:




											"""simple docstring"""





											warnings.warn(
											    '`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead.'    ,						_SCREAMING_SNAKE_CASE    ,						)
											return self.image_processor








"""simple docstring"""



_snake_case       :      Dict       =					[0.485, 0.456, 0.406]
_snake_case       :      int       =					[0.229, 0.224, 0.225]
_snake_case       :      Optional[int]       =					[0.5, 0.5, 0.5]
_snake_case       :      str       =					[0.5, 0.5, 0.5]
_snake_case       :      str       =					[0.4814_5466, 0.457_8275, 0.4082_1073]
_snake_case       :      str       =					[0.2686_2954, 0.2613_0258, 0.2757_7711]