

import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from .tokenization_lxmert import LxmertTokenizer


lowerCAmelCase__       = {"vocab_file": "vocab.txt", "tokenizer_file": "tokenizer.json"}

lowerCAmelCase__       = {
    "vocab_file": {
        "unc-nlp/lxmert-base-uncased": "https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/vocab.txt",
    },
    "tokenizer_file": {
        "unc-nlp/lxmert-base-uncased": (
            "https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/tokenizer.json"
        ),
    },
}

lowerCAmelCase__       = {
    "unc-nlp/lxmert-base-uncased": 512,
}

lowerCAmelCase__       = {
    "unc-nlp/lxmert-base-uncased": {"do_lower_case": True},
}






class 						__magic_name__    (       _snake_case    ):
 UpperCAmelCase							    =						VOCAB_FILES_NAMES
 UpperCAmelCase							    =						PRETRAINED_VOCAB_FILES_MAP
 UpperCAmelCase							    =						PRETRAINED_INIT_CONFIGURATION
 UpperCAmelCase							    =						PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
 UpperCAmelCase							    =						LxmertTokenizer


 def __init__(						self		: Optional[int]			,						lowerCAmelCase__		: List[str]=None			,						lowerCAmelCase__		: List[str]=None			,						lowerCAmelCase__		: List[Any]=True			,						lowerCAmelCase__		: List[str]="[UNK]"			,						lowerCAmelCase__		: Dict="[SEP]"			,						lowerCAmelCase__		: Any="[PAD]"			,						lowerCAmelCase__		: List[str]="[CLS]"			,						lowerCAmelCase__		: Union[str, Any]="[MASK]"			,						lowerCAmelCase__		: Tuple=True			,						lowerCAmelCase__		: Any=None			,						**lowerCAmelCase__		: Optional[int]			,						)    ->      List[str]:
   super().__init__(
       lowerCAmelCase__			,						tokenizer_file=lowerCAmelCase__			,						do_lower_case=lowerCAmelCase__			,						unk_token=lowerCAmelCase__			,						sep_token=lowerCAmelCase__			,						pad_token=lowerCAmelCase__			,						cls_token=lowerCAmelCase__			,						mask_token=lowerCAmelCase__			,						tokenize_chinese_chars=lowerCAmelCase__			,						strip_accents=lowerCAmelCase__			,						**lowerCAmelCase__			,						)

   UpperCAmelCase					      =  json.loads(self.backend_tokenizer.normalizer.__getstate__()    )
   if (
       normalizer_state.get("lowercase"			,						lowerCAmelCase__    ) != do_lower_case
       or normalizer_state.get("strip_accents"			,						lowerCAmelCase__    ) != strip_accents
       or normalizer_state.get("handle_chinese_chars"			,						lowerCAmelCase__    ) != tokenize_chinese_chars
   ):
     UpperCAmelCase					      =  getattr(lowerCAmelCase__			,						normalizer_state.pop("type"    )    )
     UpperCAmelCase					      =  do_lower_case
     UpperCAmelCase					      =  strip_accents
     UpperCAmelCase					      =  tokenize_chinese_chars
     UpperCAmelCase					      =  normalizer_class(**lowerCAmelCase__    )

   UpperCAmelCase					      =  do_lower_case


 def _UpperCamelCase	(						self		: Dict			,						lowerCAmelCase__		: Union[str, Any]			,						lowerCAmelCase__		: Dict=None    )    ->      Optional[Any]:
   UpperCAmelCase					      =  [self.cls_token_id] + token_ids_a + [self.sep_token_id]

   if token_ids_a:
     output += token_ids_a + [self.sep_token_id]

   return output


 def _UpperCamelCase	(						self		: Optional[Any]			,						lowerCAmelCase__		: List[int]			,						lowerCAmelCase__		: Optional[List[int]] = None    )    ->      List[int]:
   UpperCAmelCase					      =  [self.sep_token_id]
   UpperCAmelCase					      =  [self.cls_token_id]
   if token_ids_a is None:
     return len(cls + token_ids_a + sep    ) * [0]
   return len(cls + token_ids_a + sep    ) * [0] + len(token_ids_a + sep    ) * [1]


 def _UpperCamelCase	(						self		: List[Any]			,						lowerCAmelCase__		: str			,						lowerCAmelCase__		: Optional[str] = None    )    ->      Tuple[str]:
   UpperCAmelCase					      =  self._tokenizer.model.save(lowerCAmelCase__			,						name=lowerCAmelCase__    )
   return tuple(lowerCAmelCase__    )






def      _lowerCAmelCase(	__A			):
  UpperCAmelCase					      =  0
  while num > 0:
    digit_sum += num % 10
    num //= 10
  return digit_sum
def      _lowerCAmelCase(	__A = 100			):
  UpperCAmelCase					      =  1
  UpperCAmelCase					      =  2

  for i in range(2   ,       max_n + 1			):
    UpperCAmelCase					      =  pre_numerator
    UpperCAmelCase					      =  2 * i // 3 if i % 3 == 0 else 1
    UpperCAmelCase					      =  cur_numerator
    UpperCAmelCase					      =  e_cont * pre_numerator + temp

  return sum_digits(__A			)


if __name__ == "__main__":
      print(f"{solution() = }")



