

"""simple docstring"""


from ...configuration_utils import PretrainedConfig
from ...utils import logging


a					:Optional[Any]    = logging.get_logger(__name__)

a					:Optional[Any]    = {
    "s-JoL/Open-Llama-V1": "https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config.json",
}

class      __a							(UpperCamelCase_):






     '''simple docstring'''
     _SCREAMING_SNAKE_CASE						:Any       = """open-llama"""

     def __init__(						self	,    _a=100_000	,    _a=4_096	,    _a=11_008	,    _a=32	,    _a=32	,    _a="silu"	,    _a=2_048	,    _a=0.02	,    _a=1E-6	,    _a=True	,    _a=0	,    _a=1	,    _a=2	,    _a=False	,    _a=True	,    _a=0.1	,    _a=0.1	,    _a=True	,    _a=True	,    _a=None	,    **_a	,    )  ->      str:


           """simple docstring"""


           SCREAMING_SNAKE_CASE__   :      Optional[Any]      		=	vocab_size
           SCREAMING_SNAKE_CASE__   :      Tuple      		=	max_position_embeddings
           SCREAMING_SNAKE_CASE__   :      str      		=	hidden_size
           SCREAMING_SNAKE_CASE__   :      Tuple      		=	intermediate_size
           SCREAMING_SNAKE_CASE__   :      Tuple      		=	num_hidden_layers
           SCREAMING_SNAKE_CASE__   :      List[Any]      		=	num_attention_heads
           SCREAMING_SNAKE_CASE__   :      List[str]      		=	hidden_act
           SCREAMING_SNAKE_CASE__   :      Any      		=	initializer_range
           SCREAMING_SNAKE_CASE__   :      List[str]      		=	rms_norm_eps
           SCREAMING_SNAKE_CASE__   :      str      		=	use_cache
           SCREAMING_SNAKE_CASE__   :      Union[str, Any]      		=	kwargs.pop(
               """use_memorry_efficient_attention"""	,    _a  )
           SCREAMING_SNAKE_CASE__   :      Union[str, Any]      		=	hidden_dropout_prob
           SCREAMING_SNAKE_CASE__   :      Dict      		=	attention_dropout_prob
           SCREAMING_SNAKE_CASE__   :      Dict      		=	use_stable_embedding
           SCREAMING_SNAKE_CASE__   :      Union[str, Any]      		=	shared_input_output_embedding
           SCREAMING_SNAKE_CASE__   :      Dict      		=	rope_scaling
           self._rope_scaling_validation()

           super().__init__(
               pad_token_id=_a	,    bos_token_id=_a	,    eos_token_id=_a	,    tie_word_embeddings=_a	,    **_a	,    )





     def 					_a			(						self  )  ->      str:


           """simple docstring"""


           if self.rope_scaling is None:
                 return

           if not isinstance(self.rope_scaling	,    _a  ) or len(self.rope_scaling  ) != 2:
                 raise ValueError(
                     """`rope_scaling` must be a dictionary with with two fields, `name` and `factor`, """
                     f'''got {self.rope_scaling}'''  )
           SCREAMING_SNAKE_CASE__   :      List[Any]      		=	self.rope_scaling.get("""type"""	,    _a  )
           SCREAMING_SNAKE_CASE__   :      Optional[Any]      		=	self.rope_scaling.get("""factor"""	,    _a  )
           if rope_scaling_type is None or rope_scaling_type not in ["linear", "dynamic"]:
                 raise ValueError(
                     f'''`rope_scaling`\'s name field must be one of [\'linear\', \'dynamic\'], got {rope_scaling_type}'''  )
           if rope_scaling_factor is None or not isinstance(_a	,    _a  ) or rope_scaling_factor <= 1.0:
                 raise ValueError(f'''`rope_scaling`\'s factor field must be an float > 1, got {rope_scaling_factor}'''  )







"""simple docstring"""


import os
from shutil import copyfile
from typing import List, Optional, Tuple

from ...tokenization_utils import AddedToken
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import is_sentencepiece_available, logging


if is_sentencepiece_available():
  from .tokenization_xlnet import XLNetTokenizer
else:
  a					:List[Any]    = None


a					:Optional[int]    = logging.get_logger(__name__)

a					:Union[str, Any]    = {"vocab_file": "spiece.model", "tokenizer_file": "tokenizer.json"}

a					:Optional[int]    = {
    "vocab_file": {
        "xlnet-base-cased": "https://huggingface.co/xlnet-base-cased/resolve/main/spiece.model",
        "xlnet-large-cased": "https://huggingface.co/xlnet-large-cased/resolve/main/spiece.model",
    },
    "tokenizer_file": {
        "xlnet-base-cased": "https://huggingface.co/xlnet-base-cased/resolve/main/tokenizer.json",
        "xlnet-large-cased": "https://huggingface.co/xlnet-large-cased/resolve/main/tokenizer.json",
    },
}

a					:Dict    = {
    "xlnet-base-cased": None,
    "xlnet-large-cased": None,
}

a					:int    = "▁"

# Segments (not really needed)
a					:Dict    = 0
a					:Optional[int]    = 1
a					:Tuple    = 2
a					:List[str]    = 3
a					:Optional[Any]    = 4

class      __a							(UpperCamelCase_):






     '''simple docstring'''
     _SCREAMING_SNAKE_CASE						:Tuple       = VOCAB_FILES_NAMES
     _SCREAMING_SNAKE_CASE						:Union[str, Any]       = PRETRAINED_VOCAB_FILES_MAP
     _SCREAMING_SNAKE_CASE						:Tuple       = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
     _SCREAMING_SNAKE_CASE						:str       = """left"""
     _SCREAMING_SNAKE_CASE						:Optional[Any]       = XLNetTokenizer

     def __init__(						self	,    _a=None	,    _a=None	,    _a=False	,    _a=True	,    _a=False	,    _a="<s>"	,    _a="</s>"	,    _a="<unk>"	,    _a="<sep>"	,    _a="<pad>"	,    _a="<cls>"	,    _a="<mask>"	,    _a=["<eop>", "<eod>"]	,    **_a	,    )  ->      Any:


           """simple docstring"""


           SCREAMING_SNAKE_CASE__   :      Tuple      		=	AddedToken(_a	,    lstrip=_a	,    rstrip=_a  ) if isinstance(_a	,    _a  ) else mask_token

           super().__init__(
               vocab_file=_a	,    tokenizer_file=_a	,    do_lower_case=_a	,    remove_space=_a	,    keep_accents=_a	,    bos_token=_a	,    eos_token=_a	,    unk_token=_a	,    sep_token=_a	,    pad_token=_a	,    cls_token=_a	,    mask_token=_a	,    additional_special_tokens=_a	,    **_a	,    )

           SCREAMING_SNAKE_CASE__   :      Union[str, Any]      		=	3
           SCREAMING_SNAKE_CASE__   :      Optional[int]      		=	do_lower_case
           SCREAMING_SNAKE_CASE__   :      List[str]      		=	remove_space
           SCREAMING_SNAKE_CASE__   :      int      		=	keep_accents
           SCREAMING_SNAKE_CASE__   :      Optional[Any]      		=	vocab_file
           SCREAMING_SNAKE_CASE__   :      Tuple      		=	False if not self.vocab_file else True

     def 					_a			(						self	,    _a	,    _a = None  )  ->      List[int]:


           """simple docstring"""


           SCREAMING_SNAKE_CASE__   :      str      		=	[self.sep_token_id]
           SCREAMING_SNAKE_CASE__   :      Tuple      		=	[self.cls_token_id]
           if token_ids_a is None:
                 return token_ids_a + sep + cls
           return token_ids_a + sep + token_ids_a + sep + cls

     def 					_a			(						self	,    _a	,    _a = None  )  ->      List[int]:


           """simple docstring"""


           SCREAMING_SNAKE_CASE__   :      Any      		=	[self.sep_token_id]
           SCREAMING_SNAKE_CASE__   :      Optional[Any]      		=	[2]

           if token_ids_a is None:
                 return len(token_ids_a + sep  ) * [0] + cls_segment_id
           return len(token_ids_a + sep  ) * [0] + len(token_ids_a + sep  ) * [1] + cls_segment_id





     def 					_a			(						self	,    _a	,    _a = None  )  ->      Tuple[str]:


           """simple docstring"""


           if not self.can_save_slow_tokenizer:
                 raise ValueError(
                     """Your fast tokenizer does not have the necessary information to save the vocabulary for a slow """
                     """tokenizer."""  )

           if not os.path.isdir(_a  ):
                 logger.error(f'''Vocabulary path ({save_directory}) should be a directory'''  )
                 return
           SCREAMING_SNAKE_CASE__   :      Tuple      		=	os.path.join(
               _a	,    (filename_prefix + """-""" if filename_prefix else """""") + VOCAB_FILES_NAMES["""vocab_file"""]  )

           if os.path.abspath(self.vocab_file  ) != os.path.abspath(_a  ):
                 copyfile(self.vocab_file	,    _a  )

           return (out_vocab_file,)




