






import warnings

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


A__	:			Tuple			   = logging.get_logger(__name__)

A__	:			List[Any]			   = {
    'xlnet-base-cased': 'https://huggingface.co/xlnet-base-cased/resolve/main/config.json',
    'xlnet-large-cased': 'https://huggingface.co/xlnet-large-cased/resolve/main/config.json',
}
class       _UpperCAmelCase					(       A__	):

				"""simple docstring"""




				lowercase__											=       """xlnet"""
				lowercase__											=       ["""mems"""]
				lowercase__											=       {
				    """n_token""": """vocab_size""",  # Backward compatibility
				    """hidden_size""": """d_model""",
				    """num_attention_heads""": """n_head""",
				    """num_hidden_layers""": """n_layer""",
				}




				def __init__(     self						:    List[str],  lowerCamelCase						:    Union[str, Any]=32_000,  lowerCamelCase						:    Any=1_024,  lowerCamelCase						:    Dict=24,  lowerCamelCase						:    Optional[Any]=16,  lowerCamelCase						:    List[str]=4_096,  lowerCamelCase						:    int="gelu",  lowerCamelCase						:    Tuple=True,  lowerCamelCase						:    Union[str, Any]="bi",  lowerCamelCase						:    Any=0.02,  lowerCamelCase						:    Optional[Any]=1E-12,  lowerCamelCase						:    Optional[Any]=0.1,  lowerCamelCase						:    Optional[int]=512,  lowerCamelCase						:    Tuple=None,  lowerCamelCase						:    Optional[Any]=True,  lowerCamelCase						:    Optional[int]=False,  lowerCamelCase						:    List[Any]=False,  lowerCamelCase						:    int=-1,  lowerCamelCase						:    int=False,  lowerCamelCase						:    Union[str, Any]="last",  lowerCamelCase						:    Any=True,  lowerCamelCase						:    List[str]="tanh",  lowerCamelCase						:    Optional[int]=0.1,  lowerCamelCase						:    Optional[int]=5,  lowerCamelCase						:    str=5,  lowerCamelCase						:    List[str]=5,  lowerCamelCase						:    Any=1,  lowerCamelCase						:    List[Any]=2,  **lowerCamelCase						:    Optional[Any],  ):

								'''simple docstring'''
								lowercase__    =			vocab_size
								lowercase__    =			d_model
								lowercase__    =			n_layer
								lowercase__    =			n_head
								if d_model % n_head != 0:
												raise ValueError(F"""'d_model % n_head' ({d_model % n_head}) should be equal to 0"""  )
								if "d_head" in kwargs:
												if kwargs["d_head"] != d_model // n_head:
																raise ValueError(
																    F"""`d_head` ({kwargs['d_head']}) should be equal to `d_model // n_head` ({d_model // n_head})"""  )
								lowercase__    =			d_model // n_head
								lowercase__    =			ff_activation
								lowercase__    =			d_inner
								lowercase__    =			untie_r
								lowercase__    =			attn_type

								lowercase__    =			initializer_range
								lowercase__    =			layer_norm_eps

								lowercase__    =			dropout
								lowercase__    =			mem_len
								lowercase__    =			reuse_len
								lowercase__    =			bi_data
								lowercase__    =			clamp_len
								lowercase__    =			same_length

								lowercase__    =			summary_type
								lowercase__    =			summary_use_proj
								lowercase__    =			summary_activation
								lowercase__    =			summary_last_dropout
								lowercase__    =			start_n_top
								lowercase__    =			end_n_top

								lowercase__    =			bos_token_id
								lowercase__    =			pad_token_id
								lowercase__    =			eos_token_id

								if "use_cache" in kwargs:
												warnings.warn(
												    '''The `use_cache` argument is deprecated and will be removed in a future version, use `use_mems_eval`'''
												    ''' instead.''',  lowerCamelCase,  )
												lowercase__    =			kwargs['''use_cache''']

								lowercase__    =			use_mems_eval
								lowercase__    =			use_mems_train
								super().__init__(pad_token_id=lowerCamelCase,  bos_token_id=lowerCamelCase,  eos_token_id=lowerCamelCase,  **lowerCamelCase  )




				@property
				def 				lowercase__   (     self						:    Optional[Any]  ):

								'''simple docstring'''
								logger.info(F"""The model {self.model_type} is one of the few models that has no sequence length limit."""  )
								return -1




				@max_position_embeddings.setter
				def 				lowercase__   (     self						:    Optional[int],  lowerCamelCase						:    Dict  ):

								'''simple docstring'''
								# Message copied from Transformer-XL documentation
								raise NotImplementedError(
								    F"""The model {self.model_type} is one of the few models that has no sequence length limit."""  )












from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available


A__	:			Optional[int]			   = {}

try:
							if not is_sentencepiece_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							A__	:			Optional[int]			   = ['GPTSw3Tokenizer']


if TYPE_CHECKING:
							try:
														if not is_sentencepiece_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .tokenization_gpt_swa import GPTSwaTokenizer

else:
							import sys

							A__	:			Optional[int]			   = _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)




