


"""simple docstring"""


import warnings
from typing import List, Optional, Union

from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy
from ...utils import TensorType



class       lowerCamelCase__    ( lowerCAmelCase__      ):
						lowerCAmelCase  	=  ['''image_processor''', '''tokenizer''']
						lowerCAmelCase  	=  '''ViltImageProcessor'''
						lowerCAmelCase  	=  ('''BertTokenizer''', '''BertTokenizerFast''')







						def __init__(				self :     Tuple      ,      _lowercase :     Optional[int]=None      ,      _lowercase :     List[str]=None      ,      **_lowercase :     Optional[Any]		):
								A       							=			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      ,      )
										A       							=			kwargs.pop('feature_extractor'		)

								A       							=			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		)
								A       							=			self.image_processor







						def __call__(				self :     Union[str, Any]      ,      _lowercase :     Tuple      ,      _lowercase :     List[Any] = None      ,      _lowercase :     List[str] = True      ,      _lowercase :     Dict = False      ,      _lowercase :     List[str] = None      ,      _lowercase :     Union[str, Any] = None      ,      _lowercase :     int = 0      ,      _lowercase :     Any = None      ,      _lowercase :     List[str] = None      ,      _lowercase :     Dict = None      ,      _lowercase :     Optional[Any] = False      ,      _lowercase :     Any = False      ,      _lowercase :     Dict = False      ,      _lowercase :     Union[str, Any] = False      ,      _lowercase :     Tuple = True      ,      _lowercase :     List[str] = None      ,      **_lowercase :     Any      ,      ):
								A       							=			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      ,      )
								# add pixel_values + pixel_mask
								A       							=			self.image_processor(__lowerCAmelCase      ,      return_tensors=__lowerCAmelCase		)
								encoding.update(__lowerCAmelCase		)

								return encoding







						def __a    (				self :     List[str]      ,      *_lowercase :     Tuple      ,      **_lowercase :     List[str]		):
								return self.tokenizer.batch_decode(*__lowerCAmelCase      ,      **__lowerCAmelCase		)







						def __a    (				self :     Optional[Any]      ,      *_lowercase :     Tuple      ,      **_lowercase :     int		):
								return self.tokenizer.decode(*__lowerCAmelCase      ,      **__lowerCAmelCase		)







						@property
						def __a    (				self :     Union[str, Any]		):
								A       							=			self.tokenizer.model_input_names
								A       							=			self.image_processor.model_input_names
								return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names		)		)







						@property
						def __a    (				self :     int		):
								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 :     Tuple		):
								warnings.warn(
								    '`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead.'      ,      __lowerCAmelCase      ,      )
								return self.image_processor






'''simple docstring'''




from functools import lru_cache






@lru_cache
def 							snake_case__				(     _A:   int					)       ->      int:

		'''simple docstring'''


		if num < 0:
				raise ValueError("""Number should not be negative."""					)

		return 1 if num in (0, 1) else num * factorial(num - 1					)


if __name__ == "__main__":
						import doctest

						doctest.testmod()




