



"""simple docstring"""






import warnings

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


_lowercase			:			Union[str, Any]										=						logging.get_logger(__name__)

_lowercase			:			Dict										=						{
    "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 	__SCREAMING_SNAKE_CASE     (				lowerCAmelCase_       ):


					'''simple docstring'''





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



					def __init__(	self							:  int,  lowerCamelCase							:  Tuple=3_2000,  lowerCamelCase							:  Optional[Any]=1024,  lowerCamelCase							:  int=24,  lowerCamelCase							:  Optional[int]=16,  lowerCamelCase							:  Dict=4096,  lowerCamelCase							:  Union[str, Any]="gelu",  lowerCamelCase							:  Any=True,  lowerCamelCase							:  List[Any]="bi",  lowerCamelCase							:  int=0.02,  lowerCamelCase							:  List[str]=1E-12,  lowerCamelCase							:  str=0.1,  lowerCamelCase							:  str=512,  lowerCamelCase							:  Any=None,  lowerCamelCase							:  List[str]=True,  lowerCamelCase							:  Tuple=False,  lowerCamelCase							:  Optional[int]=False,  lowerCamelCase							:  List[Any]=-1,  lowerCamelCase							:  Dict=False,  lowerCamelCase							:  Optional[Any]="last",  lowerCamelCase							:  List[str]=True,  lowerCamelCase							:  str="tanh",  lowerCamelCase							:  str=0.1,  lowerCamelCase							:  Tuple=5,  lowerCamelCase							:  Any=5,  lowerCamelCase							:  Tuple=5,  lowerCamelCase							:  List[str]=1,  lowerCamelCase							:  Optional[int]=2,  **lowerCamelCase							:  Tuple,  )-> int:
								lowerCamelCase__		:		Optional[int]		     =vocab_size
								lowerCamelCase__		:		Any		     =d_model
								lowerCamelCase__		:		int		     =n_layer
								lowerCamelCase__		:		List[Any]		     =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})'''					)
								lowerCamelCase__		:		Tuple		     =d_model // n_head
								lowerCamelCase__		:		Dict		     =ff_activation
								lowerCamelCase__		:		int		     =d_inner
								lowerCamelCase__		:		Any		     =untie_r
								lowerCamelCase__		:		Any		     =attn_type

								lowerCamelCase__		:		Union[str, Any]		     =initializer_range
								lowerCamelCase__		:		Union[str, Any]		     =layer_norm_eps

								lowerCamelCase__		:		Union[str, Any]		     =dropout
								lowerCamelCase__		:		Optional[int]		     =mem_len
								lowerCamelCase__		:		Optional[Any]		     =reuse_len
								lowerCamelCase__		:		Union[str, Any]		     =bi_data
								lowerCamelCase__		:		str		     =clamp_len
								lowerCamelCase__		:		Any		     =same_length

								lowerCamelCase__		:		int		     =summary_type
								lowerCamelCase__		:		Optional[int]		     =summary_use_proj
								lowerCamelCase__		:		Tuple		     =summary_activation
								lowerCamelCase__		:		List[str]		     =summary_last_dropout
								lowerCamelCase__		:		Optional[Any]		     =start_n_top
								lowerCamelCase__		:		int		     =end_n_top

								lowerCamelCase__		:		Tuple		     =bos_token_id
								lowerCamelCase__		:		Dict		     =pad_token_id
								lowerCamelCase__		:		Dict		     =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,  )
											lowerCamelCase__		:		str		     =kwargs['''use_cache''']

								lowerCamelCase__		:		int		     =use_mems_eval
								lowerCamelCase__		:		Tuple		     =use_mems_train
								super().__init__(pad_token_id=lowerCamelCase,  bos_token_id=lowerCamelCase,  eos_token_id=lowerCamelCase,  **lowerCamelCase					)



					@property
					def 		snake_case	(	self							:  Any					)-> Tuple:
								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 		snake_case	(	self							:  str,  lowerCamelCase							:  Union[str, Any]					)-> Optional[int]:
								# 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.'''					)









"""simple docstring"""






from ..utils import DummyObject, requires_backends

class 	__SCREAMING_SNAKE_CASE     (				metaclass=lowerCAmelCase_       ):


					'''simple docstring'''





					_a             =							['torch', 'torchsde']



					def __init__(	self							:  Union[str, Any],  *lowerCamelCase							:  str,  **lowerCamelCase							:  int					)-> Tuple:
								requires_backends(self,  ['''torch''', '''torchsde''']					)



					@classmethod
					def 		snake_case	(	cls							:  List[str],  *lowerCamelCase							:  Optional[Any],  **lowerCamelCase							:  Dict					)-> str:
								requires_backends(cls,  ['''torch''', '''torchsde''']					)




					@classmethod
					def 		snake_case	(	cls							:  Tuple,  *lowerCamelCase							:  Dict,  **lowerCamelCase							:  Tuple					)-> List[str]:
								requires_backends(cls,  ['''torch''', '''torchsde''']					)




