




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 				UpperCamelCase_    ( UpperCAmelCase__     ):

    '''simple docstring'''






    UpperCAmelCase__							  =      ["""image_processor""", """tokenizer"""]
    UpperCAmelCase__							  =      """ViltImageProcessor"""
    UpperCAmelCase__							  =      ("""BertTokenizer""", """BertTokenizerFast""")


    def __init__(			self      :	Optional[Any]					, UpperCAmelCase__      :	int=None					, UpperCAmelCase__      :	Optional[int]=None					, **UpperCAmelCase__      :	Any)						->List[Any]:





           '''simple docstring'''

           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.'''					, snake_case_					, )
                  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__(snake_case_					, snake_case_)
           A__       =    self.image_processor


    def __call__(			self      :	Any					, UpperCAmelCase__      :	str					, UpperCAmelCase__      :	List[str] = None					, UpperCAmelCase__      :	Any = True					, UpperCAmelCase__      :	Tuple = False					, UpperCAmelCase__      :	Any = None					, UpperCAmelCase__      :	Tuple = None					, UpperCAmelCase__      :	Tuple = 0					, UpperCAmelCase__      :	Optional[Any] = None					, UpperCAmelCase__      :	Tuple = None					, UpperCAmelCase__      :	Optional[int] = None					, UpperCAmelCase__      :	List[Any] = False					, UpperCAmelCase__      :	Any = False					, UpperCAmelCase__      :	List[str] = False					, UpperCAmelCase__      :	Tuple = False					, UpperCAmelCase__      :	Optional[Any] = True					, UpperCAmelCase__      :	Tuple = None					, **UpperCAmelCase__      :	Any					, )						->Union[str, Any]:





           '''simple docstring'''

           A__       =    self.tokenizer(
               text=snake_case_					, add_special_tokens=snake_case_					, padding=snake_case_					, truncation=snake_case_					, max_length=snake_case_					, stride=snake_case_					, pad_to_multiple_of=snake_case_					, return_token_type_ids=snake_case_					, return_attention_mask=snake_case_					, return_overflowing_tokens=snake_case_					, return_special_tokens_mask=snake_case_					, return_offsets_mapping=snake_case_					, return_length=snake_case_					, verbose=snake_case_					, return_tensors=snake_case_					, **snake_case_					, )
           # add pixel_values + pixel_mask
           A__       =    self.image_processor(snake_case_					, return_tensors=snake_case_)
           encoding.update(snake_case_)

           return encoding


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





           '''simple docstring'''

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


    def        SCREAMING_SNAKE_CASE							(			self      :	int					, *UpperCAmelCase__      :	Dict					, **UpperCAmelCase__      :	int)						->List[Any]:





           '''simple docstring'''

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


    @property
    def        SCREAMING_SNAKE_CASE							(			self      :	Any)						->int:





           '''simple docstring'''

           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        SCREAMING_SNAKE_CASE							(			self      :	str)						->Optional[Any]:





           '''simple docstring'''

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





    @property
    def        SCREAMING_SNAKE_CASE							(			self      :	Tuple)						->int:





           '''simple docstring'''

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









"""simple docstring"""




from transformers import BertTokenizerFast

from .custom_tokenization import CustomTokenizer

class  _UpperCAmelCase  (   UpperCAmelCase__		):



      '''simple docstring'''
      lowercase_      : List[str]	    =   CustomTokenizer
      pass