


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


UpperCAmelCase__            =							logging.get_logger(__name__)

UpperCAmelCase__            =							{'''vocab_file''': '''vocab.json''', '''merges_file''': '''merges.txt''', '''tokenizer_file''': '''tokenizer.json'''}

UpperCAmelCase__            =							{
    '''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'''
        ),
    },
}

UpperCAmelCase__            =							{
    '''openai/clip-vit-base-patch32''': 77,
}







class 				lowerCamelCase__       (	lowerCAmelCase):
     SCREAMING_SNAKE_CASE__				      =      VOCAB_FILES_NAMES
     SCREAMING_SNAKE_CASE__				      =      PRETRAINED_VOCAB_FILES_MAP
     SCREAMING_SNAKE_CASE__				      =      PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
     SCREAMING_SNAKE_CASE__				      =      ['''input_ids''', '''attention_mask''']
     SCREAMING_SNAKE_CASE__				      =      CLIPTokenizer





     def __init__(self		,					UpperCAmelCase=None		,					UpperCAmelCase=None		,					UpperCAmelCase=None		,					UpperCAmelCase="<|endoftext|>"		,					UpperCAmelCase="<|startoftext|>"		,					UpperCAmelCase="<|endoftext|>"		,					UpperCAmelCase="<|endoftext|>"		,					**UpperCAmelCase		,					)					->       Dict:
      super().__init__(
          UpperCAmelCase		,					UpperCAmelCase		,					tokenizer_file=UpperCAmelCase		,					unk_token=UpperCAmelCase		,					bos_token=UpperCAmelCase		,					eos_token=UpperCAmelCase		,					pad_token=UpperCAmelCase		,					**UpperCAmelCase		,					)

      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 					__A (self	)					->       List[str]:
      _lowercase											=self.backend_tokenizer.decode

      def new_decode_method(*UpperCAmelCase		,					**UpperCAmelCase	):
       _lowercase											=orig_decode_method(*UpperCAmelCase		,					**UpperCAmelCase	)
       _lowercase											=text.replace(self.backend_tokenizer.model.end_of_word_suffix		,					''' '''	).strip()
       return text

      _lowercase											=new_decode_method





     def 					__A (self		,					UpperCAmelCase		,					UpperCAmelCase = None	)					->       List[int]:
      _lowercase											=[self.bos_token_id]
      _lowercase											=[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 					__A (self		,					UpperCAmelCase		,					UpperCAmelCase = None	)					->       List[int]:
      _lowercase											=[self.bos_token_id]
      _lowercase											=[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 					__A (self		,					UpperCAmelCase		,					UpperCAmelCase = None	)					->       Tuple[str]:
      _lowercase											=self._tokenizer.model.save(UpperCAmelCase		,					name=UpperCAmelCase	)
      return tuple(UpperCAmelCase	)





from math import sqrt
def     UpperCAmelCase_ (							__snake_case						)					->      list[int]:







 """simple docstring"""


 _lowercase											=[1]
 for i in range(2					,						int(sqrt(__snake_case						)						) + 1					,						1						):
  if number % i == 0:
   values.append(__snake_case						)
   if int(number // i						) != i:
    values.append(int(number // i						)						)
 return sorted(__snake_case						)
def     UpperCAmelCase_ (							__snake_case						)					->      bool:







 """simple docstring"""


 return sum(factors(__snake_case						)						) > n
def     UpperCAmelCase_ (							__snake_case						)					->      bool:







 """simple docstring"""


 _lowercase											=factors(__snake_case						)
 _lowercase											=len(__snake_case						)
 _lowercase											=[[0 for i in range(number + 1						)] for j in range(r + 1						)]
 for i in range(r + 1						):
  _lowercase											=True

 for i in range(1					,						number + 1						):
  _lowercase											=False

 for i in range(1					,						r + 1						):
  for j in range(1					,						number + 1						):
   if j < values[i - 1]:
    _lowercase											=subset[i - 1][j]
   else:
    _lowercase											=subset[i - 1][j] or subset[i - 1][j - values[i - 1]]

 return subset[r][number] != 0
def     UpperCAmelCase_ (							__snake_case						)					->      bool:







 """simple docstring"""


 return abundant(__snake_case						) and not semi_perfect(__snake_case						)


if __name__ == "__main__":
  import doctest

  doctest.testmod(verbose=True)
  for number in (69, 70, 71):
    print(f'''{number} is {'' if weird(number) else 'not '}weird.''')

