
'''simple docstring'''
from typing import Optional, Tuple

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_openai import OpenAIGPTTokenizer


A__ :		Dict					=logging.get_logger(__name__)

A__ :		Optional[int]					={'vocab_file': 'vocab.json', 'merges_file': 'merges.txt', 'tokenizer_file': 'tokenizer.json'}

A__ :		Optional[int]					={
    'vocab_file': {'openai-gpt': 'https://huggingface.co/openai-gpt/resolve/main/vocab.json'},
    'merges_file': {'openai-gpt': 'https://huggingface.co/openai-gpt/resolve/main/merges.txt'},
    'tokenizer_file': {'openai-gpt': 'https://huggingface.co/openai-gpt/resolve/main/tokenizer.json'},
}

A__ :		Tuple					={
    'openai-gpt': 512,
}







class 			__A					(			_SCREAMING_SNAKE_CASE      ):
 lowerCamelCase												=VOCAB_FILES_NAMES
 lowerCamelCase												=PRETRAINED_VOCAB_FILES_MAP
 lowerCamelCase												=PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
 lowerCamelCase												=['''input_ids''', '''attention_mask''']
 lowerCamelCase												=OpenAIGPTTokenizer
 def __init__( self      :     int					, lowerCamelCase      :     str=None					, lowerCamelCase      :     Union[str, Any]=None					, lowerCamelCase      :     List[Any]=None					, lowerCamelCase      :     Dict="<unk>"					, **lowerCamelCase      :     List[str]							):



   """simple docstring"""





   super().__init__(lowerCamelCase					, lowerCamelCase					, tokenizer_file=lowerCamelCase					, unk_token=lowerCamelCase					, **lowerCamelCase							)
 @property
 def 		lowercase_( self      :     Any							):



   """simple docstring"""





   return True






 def 		lowercase_( self      :     Optional[Any]					, lowerCamelCase      :     str					, lowerCamelCase      :     Optional[str] = None							):



   """simple docstring"""





   __A		:  Optional[int]       				=		self._tokenizer.model.save(lowerCamelCase					, name=lowerCamelCase							)
   return tuple(lowerCamelCase							)





'''simple docstring'''
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding







class 			__A					(			_SCREAMING_SNAKE_CASE      ):
 lowerCamelCase												=['''image_processor''', '''tokenizer''']
 lowerCamelCase												='''EfficientNetImageProcessor'''
 lowerCamelCase												=('''BertTokenizer''', '''BertTokenizerFast''')
 def __init__( self      :     str					, lowerCamelCase      :     Optional[int]					, lowerCamelCase      :     Tuple							):



   """simple docstring"""





   super().__init__(lowerCamelCase					, lowerCamelCase							)
 def __call__( self      :     Tuple					, lowerCamelCase      :     str=None					, lowerCamelCase      :     Tuple=None					, lowerCamelCase      :     int="max_length"					, lowerCamelCase      :     int=64					, lowerCamelCase      :     Union[str, Any]=None					, **lowerCamelCase      :     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:
     __A		:  str       				=		self.tokenizer(
         lowerCamelCase					, padding=lowerCamelCase					, max_length=lowerCamelCase					, return_tensors=lowerCamelCase					, **lowerCamelCase							)

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

   if text is not None and images is not None:
     __A		:  Optional[int]       				=		image_features.pixel_values
     return encoding
   elif text is not None:
     return encoding
   else:
     return BatchEncoding(data=dict(**lowerCamelCase							)					, tensor_type=lowerCamelCase							)
 def 		lowercase_( self      :     Any					, *lowerCamelCase      :     Optional[Any]					, **lowerCamelCase      :     Union[str, Any]							):



   """simple docstring"""





   return self.tokenizer.batch_decode(*lowerCamelCase					, **lowerCamelCase							)
 def 		lowercase_( self      :     Any					, *lowerCamelCase      :     List[Any]					, **lowerCamelCase      :     Union[str, Any]							):



   """simple docstring"""





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






 @property
 def 		lowercase_( self      :     int							):



   """simple docstring"""





   __A		:  Dict       				=		self.tokenizer.model_input_names
   __A		:  int       				=		self.image_processor.model_input_names
   return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names							)							)



