code: 
  
  
  '''simple docstring'''
  
  from typing import List, Optional, Tuple
  
  from tokenizers import pre_tokenizers
  
  from ...tokenization_utils_fast import PreTrainedTokenizerFast
  from ...utils import logging
  from .tokenization_clip import CLIPTokenizer
  
  
  lowerCAmelCase   :Union[str, Any]								=    logging.get_logger(__name__)
  
  lowerCAmelCase   :List[str]								=    {'''vocab_file''': '''vocab.json''', '''merges_file''': '''merges.txt''', '''tokenizer_file''': '''tokenizer.json'''}
  
  lowerCAmelCase   :Optional[int]								=    {
      '''vocab_file''': {
          '''openai/clip-vit-base-patch32''': '''https://huggingface.co/openai/clip-vit-base-patch32/resolve/main/vocab.json''',
      },
      '''merges_file''': {
          '''openai/clip-vit-base-patch32''': '''https://huggingface.co/openai/clip-vit-base-patch32/resolve/main/merges.txt''',
      },
      '''tokenizer_file''': {
          '''openai/clip-vit-base-patch32''': (
              '''https://huggingface.co/openai/clip-vit-base-patch32/resolve/main/tokenizer.json'''
          ),
      },
  }
  
  lowerCAmelCase   :Union[str, Any]								=    {
      '''openai/clip-vit-base-patch32''': 7_7,
  }
  class _lowerCamelCase (		lowercase__							):
  
  
  
  		'''simple docstring'''
  
  
  
  
  
  
  
  		A_			:    List[Any]   					=       VOCAB_FILES_NAMES
  		A_			:    Union[str, Any]   					=       PRETRAINED_VOCAB_FILES_MAP
  		A_			:    Optional[Any]   					=       PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
  		A_			:    Tuple   					=       ["""input_ids""", """attention_mask"""]
  		A_			:    Dict   					=       CLIPTokenizer
  
  
  
  
  
  
  
  		def __init__(      self	:		Tuple						,  _A	:		List[str]=None						,  _A	:		Optional[Any]=None						,  _A	:		Optional[int]=None						,  _A	:		Any="<|endoftext|>"						,  _A	:		Optional[Any]="<|startoftext|>"						,  _A	:		Optional[int]="<|endoftext|>"						,  _A	:		str="<|endoftext|>"						,  **_A	:		List[str]						,  )						->				str:
  			super().__init__(
  			    _A						,  _A						,  tokenizer_file=_A						,  unk_token=_A						,  bos_token=_A						,  eos_token=_A						,  pad_token=_A						,  **_A						,  )
  
  			if not isinstance(self.backend_tokenizer.pre_tokenizer						,  pre_tokenizers.Sequence    ):
  				raise ValueError(
  				    'The `backend_tokenizer` provided does not match the expected format. The CLIP tokenizer has been'
  				    ' heavily modified from transformers version 4.17.0. You need to convert the tokenizer you are using'
  				    ' to be compatible with this version.The easiest way to do so is'
  				    ' `CLIPTokenizerFast.from_pretrained("path_to_local_folder_or_hub_repo, from_slow=True)`. If you want'
  				    ' to use your existing tokenizer, you will have to revert to a version prior to 4.17.0 of'
  				    ' transformers.'    )
  
  			self._wrap_decode_method_backend_tokenizer()
  
  
  
  
  
  
  
  		def      __lowerCAmelCase	(      self	:		Optional[Any]    )						->				Union[str, Any]:
  			__magic_name__ :					Dict  			=  self.backend_tokenizer.decode
  
  			def new_decode_method(*_A	:		Dict						,  **_A	:		Tuple    ):
  				__magic_name__ :					Tuple  			=  orig_decode_method(*_A						,  **_A    )
  				__magic_name__ :					Any  			=  text.replace(self.backend_tokenizer.model.end_of_word_suffix						,  ' '    ).strip()
  				return text
  
  			__magic_name__ :					Union[str, Any]  			=  new_decode_method
  
  
  
  
  
  
  
  		def      __lowerCAmelCase	(      self	:		Dict						,  _A	:		List[int]						,  _A	:		Optional[List[int]] = None    )						->				List[int]:
  			__magic_name__ :					List[str]  			=  [self.bos_token_id]
  			__magic_name__ :					int  			=  [self.eos_token_id]
  
  			if token_ids_a is None:
  				return bos_token + token_ids_a + eos_token
  			return bos_token + token_ids_a + eos_token + eos_token + token_ids_a + eos_token
  
  
  
  
  
  
  
  		def      __lowerCAmelCase	(      self	:		int						,  _A	:		List[int]						,  _A	:		Optional[List[int]] = None    )						->				List[int]:
  			__magic_name__ :					Tuple  			=  [self.bos_token_id]
  			__magic_name__ :					Union[str, Any]  			=  [self.eos_token_id]
  
  			if token_ids_a is None:
  				return len(bos_token + token_ids_a + eos_token    ) * [0]
  			return len(bos_token + token_ids_a + eos_token + eos_token + token_ids_a + eos_token    ) * [0]
  
  
  
  
  
  
  
  		def      __lowerCAmelCase	(      self	:		str						,  _A	:		str						,  _A	:		Optional[str] = None    )						->				Tuple[str]:
  			__magic_name__ :					str  			=  self._tokenizer.model.save(_A						,  name=_A    )
  			return tuple(_A    )
style_context: 
  
  
  '''simple docstring'''
  
  from .number_theory.prime_numbers import next_prime
  class _lowerCamelCase :
  
  
  
  		'''simple docstring'''
  
  
  
  
  
  
  
  		def __init__(      self	:		Dict						,  _A	:		int						,  _A	:		int | None = None						,  _A	:		float | None = None						,  )						->				None:
  			__magic_name__ :					Optional[int]  			=  size_table
  			__magic_name__ :					int  			=  [None] * self.size_table
  			__magic_name__ :					int  			=  0.75 if lim_charge is None else lim_charge
  			__magic_name__ :					int  			=  1 if charge_factor is None else charge_factor
  			__magic_name__ :					list  			=  []
  			__magic_name__ :					dict  			=  {}
  
  
  
  
  
  
  
  		def      __lowerCAmelCase	(      self	:		List[str]    )						->				str:
  			return self._keys
  
  
  
  
  
  
  
  		def      __lowerCAmelCase	(      self	:		Dict    )						->				Optional[Any]:
  			return sum(1 for slot in self.values if slot is not None    ) / (
  			    self.size_table * self.charge_factor
  			)
  
  
  
  
  
  
  
  		def      __lowerCAmelCase	(      self	:		int						,  _A	:		int    )						->				List[Any]:
  			return key % self.size_table
  
  
  
  
  
  
  
  		def      __lowerCAmelCase	(      self	:		List[Any]						,  _A	:		Tuple    )						->				Optional[int]:
  			print(F'step {step_ord}'    )
  			print(list(range(len(self.values    )    )    )    )
  			print(self.values    )
  
  
  
  
  
  
  
  		def      __lowerCAmelCase	(      self	:		str						,  _A	:		Optional[Any]    )						->				Optional[int]:
  			__magic_name__ :					int  			=  1
  			__magic_name__ :					Optional[int]  			=  values
  			for value in values:
  				self.insert_data(_A    )
  				self._step_by_step(_A    )
  				i += 1
  
  
  
  
  
  
  
  		def      __lowerCAmelCase	(      self	:		List[Any]						,  _A	:		List[str]						,  _A	:		List[Any]    )						->				Dict:
  			__magic_name__ :					str  			=  data
  			__magic_name__ :					Optional[int]  			=  data
  
  
  
  
  
  
  
  		def      __lowerCAmelCase	(      self	:		Union[str, Any]						,  _A	:		List[Any]						,  _A	:		Union[str, Any]=None    )						->				int:
  			__magic_name__ :					int  			=  self.hash_function(key + 1    )
  
  			while self.values[new_key] is not None and self.values[new_key] != key:
  				if self.values.count(_A    ) > 0:
  					__magic_name__ :					Dict  			=  self.hash_function(new_key + 1    )
  				else:
  					__magic_name__ :					Tuple  			=  None
  					break
  
  			return new_key
  
  
  
  
  
  
  
  		def      __lowerCAmelCase	(      self	:		List[str]    )						->				Tuple:
  			__magic_name__ :					Dict  			=  [value for value in self.values if value is not None]
  			__magic_name__ :					int  			=  next_prime(self.size_table						,  factor=2    )
  			self._keys.clear()
  			__magic_name__ :					Tuple  			=  [None] * self.size_table  # hell's pointers D: don't DRY ;/
  			for value in survivor_values:
  				self.insert_data(_A    )
  
  
  
  
  
  
  
  		def      __lowerCAmelCase	(      self	:		Tuple						,  _A	:		Union[str, Any]    )						->				Tuple:
  			__magic_name__ :					Tuple  			=  self.hash_function(_A    )
  
  			if self.values[key] is None:
  				self._set_value(_A						,  _A    )
  
  			elif self.values[key] == data:
  				pass
  
  			else:
  				__magic_name__ :					str  			=  self._collision_resolution(_A						,  _A    )
  				if collision_resolution is not None:
  					self._set_value(_A						,  _A    )
  				else:
  					self.rehashing()
  					self.insert_data(_A    )