'''simple docstring'''




import json
from typing import TYPE_CHECKING, List, Optional, Tuple

from tokenizers import pre_tokenizers

from ...tokenization_utils_base import BatchEncoding
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_gpta import GPTaTokenizer


if TYPE_CHECKING:
  from transformers.pipelines.conversational import Conversation


__UpperCAmelCase					=logging.get_logger(__name__)

__UpperCAmelCase					={"vocab_file": "vocab.json", "merges_file": "merges.txt", "tokenizer_file": "tokenizer.json"}

__UpperCAmelCase					={
    "vocab_file": {
        "gpt2": "https://huggingface.co/gpt2/resolve/main/vocab.json",
        "gpt2-medium": "https://huggingface.co/gpt2-medium/resolve/main/vocab.json",
        "gpt2-large": "https://huggingface.co/gpt2-large/resolve/main/vocab.json",
        "gpt2-xl": "https://huggingface.co/gpt2-xl/resolve/main/vocab.json",
        "distilgpt2": "https://huggingface.co/distilgpt2/resolve/main/vocab.json",
    },
    "merges_file": {
        "gpt2": "https://huggingface.co/gpt2/resolve/main/merges.txt",
        "gpt2-medium": "https://huggingface.co/gpt2-medium/resolve/main/merges.txt",
        "gpt2-large": "https://huggingface.co/gpt2-large/resolve/main/merges.txt",
        "gpt2-xl": "https://huggingface.co/gpt2-xl/resolve/main/merges.txt",
        "distilgpt2": "https://huggingface.co/distilgpt2/resolve/main/merges.txt",
    },
    "tokenizer_file": {
        "gpt2": "https://huggingface.co/gpt2/resolve/main/tokenizer.json",
        "gpt2-medium": "https://huggingface.co/gpt2-medium/resolve/main/tokenizer.json",
        "gpt2-large": "https://huggingface.co/gpt2-large/resolve/main/tokenizer.json",
        "gpt2-xl": "https://huggingface.co/gpt2-xl/resolve/main/tokenizer.json",
        "distilgpt2": "https://huggingface.co/distilgpt2/resolve/main/tokenizer.json",
    },
}

__UpperCAmelCase					={
    "gpt2": 1_0_2_4,
    "gpt2-medium": 1_0_2_4,
    "gpt2-large": 1_0_2_4,
    "gpt2-xl": 1_0_2_4,
    "distilgpt2": 1_0_2_4,
}




class        a__ (  UpperCAmelCase__					):
     lowerCamelCase    :	Union[str, Any]				=VOCAB_FILES_NAMES
     lowerCamelCase    :	Optional[int]				=PRETRAINED_VOCAB_FILES_MAP
     lowerCamelCase    :	Optional[int]				=PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
     lowerCamelCase    :	Union[str, Any]				=["input_ids", "attention_mask"]
     lowerCamelCase    :	str				=GPTaTokenizer






     def __init__(					self						:						int    ,							a						:						Union[str, Any]=None    ,							a						:						Optional[int]=None    ,							a						:						Optional[int]=None    ,							a						:						Tuple="<|endoftext|>"    ,							a						:						int="<|endoftext|>"    ,							a						:						List[str]="<|endoftext|>"    ,							a						:						Any=False    ,							**a						:						Tuple    ,							):





         """simple docstring"""



         super().__init__(
             a    ,							a    ,							tokenizer_file=a    ,							unk_token=a    ,							bos_token=a    ,							eos_token=a    ,							add_prefix_space=a    ,							**a    ,							)

         __lowerCamelCase            =    kwargs.pop('''add_bos_token'''    ,							a       )

         __lowerCamelCase            =    json.loads(self.backend_tokenizer.pre_tokenizer.__getstate__()       )
         if pre_tok_state.get('''add_prefix_space'''    ,							a       ) != add_prefix_space:
             __lowerCamelCase            =    getattr(a    ,							pre_tok_state.pop('''type'''       )       )
             __lowerCamelCase            =    add_prefix_space
             __lowerCamelCase            =    pre_tok_class(**a       )

         __lowerCamelCase            =    add_prefix_space






     def   SCREAMING_SNAKE_CASE__  (					self						:						Union[str, Any]    ,							*a						:						Dict    ,							**a						:						Optional[Any]       ):





         """simple docstring"""



         __lowerCamelCase            =    kwargs.get('''is_split_into_words'''    ,							a       )
         assert self.add_prefix_space or not is_split_into_words, (
             f"""You need to instantiate {self.__class__.__name__} with add_prefix_space=True """
             "to use it with pretokenized inputs."
         )

         return super()._batch_encode_plus(*a    ,							**a       )






     def   SCREAMING_SNAKE_CASE__  (					self						:						List[Any]    ,							*a						:						str    ,							**a						:						Optional[int]       ):





         """simple docstring"""



         __lowerCamelCase            =    kwargs.get('''is_split_into_words'''    ,							a       )

         assert self.add_prefix_space or not is_split_into_words, (
             f"""You need to instantiate {self.__class__.__name__} with add_prefix_space=True """
             "to use it with pretokenized inputs."
         )

         return super()._encode_plus(*a    ,							**a       )






     def   SCREAMING_SNAKE_CASE__  (					self						:						int    ,							a						:						str    ,							a						:						Optional[str] = None       ):





         """simple docstring"""



         __lowerCamelCase            =    self._tokenizer.model.save(a    ,							name=a       )
         return tuple(a       )






     def   SCREAMING_SNAKE_CASE__  (					self						:						Optional[Any]    ,							a						:						"Conversation"       ):





         """simple docstring"""



         __lowerCamelCase            =    []
         for is_user, text in conversation.iter_texts():
             input_ids.extend(self.encode(a    ,							add_special_tokens=a       ) + [self.eos_token_id]       )

         if len(a       ) > self.model_max_length:
             __lowerCamelCase            =    input_ids[-self.model_max_length :]
         return input_ids

'''simple docstring'''




def __lowerCAmelCase					(				)      ->       Optional[Any]:
    __lowerCamelCase            =    0
    for i in range(1							,    10_01							):
        total += i**i
    return str(UpperCamelCase__							)[-10:]


if __name__ == "__main__":
  print(solution())
