





import warnings

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


_UpperCAmelCase       =				logging.get_logger(__name__)

_UpperCAmelCase       =				{
    '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   snake_case_							(						_A		):
  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  ,    _snake_case					:	Dict=32000  ,    _snake_case					:	List[str]=1024  ,    _snake_case					:	Dict=24  ,    _snake_case					:	Optional[Any]=16  ,    _snake_case					:	Dict=4096  ,    _snake_case					:	Any="gelu"  ,    _snake_case					:	int=True  ,    _snake_case					:	List[str]="bi"  ,    _snake_case					:	Dict=0.02  ,    _snake_case					:	Union[str, Any]=1E-12  ,    _snake_case					:	Optional[Any]=0.1  ,    _snake_case					:	Optional[Any]=512  ,    _snake_case					:	List[str]=None  ,    _snake_case					:	Tuple=True  ,    _snake_case					:	Tuple=False  ,    _snake_case					:	Optional[Any]=False  ,    _snake_case					:	Union[str, Any]=-1  ,    _snake_case					:	Optional[Any]=False  ,    _snake_case					:	Any="last"  ,    _snake_case					:	List[Any]=True  ,    _snake_case					:	Tuple="tanh"  ,    _snake_case					:	int=0.1  ,    _snake_case					:	str=5  ,    _snake_case					:	str=5  ,    _snake_case					:	List[str]=5  ,    _snake_case					:	List[str]=1  ,    _snake_case					:	Optional[int]=2  ,    **_snake_case					:	List[str]  ,    )->Tuple:






   '''simple docstring'''

   __lowerCAmelCase	:			List[Any]         =  vocab_size
   __lowerCAmelCase	:			str         =  d_model
   __lowerCAmelCase	:			int         =  n_layer
   __lowerCAmelCase	:			str         =  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	:			List[str]         =  d_model // n_head
   __lowerCAmelCase	:			Optional[Any]         =  ff_activation
   __lowerCAmelCase	:			str         =  d_inner
   __lowerCAmelCase	:			List[Any]         =  untie_r
   __lowerCAmelCase	:			Dict         =  attn_type

   __lowerCAmelCase	:			int         =  initializer_range
   __lowerCAmelCase	:			List[Any]         =  layer_norm_eps

   __lowerCAmelCase	:			Tuple         =  dropout
   __lowerCAmelCase	:			str         =  mem_len
   __lowerCAmelCase	:			Tuple         =  reuse_len
   __lowerCAmelCase	:			Dict         =  bi_data
   __lowerCAmelCase	:			Optional[Any]         =  clamp_len
   __lowerCAmelCase	:			List[Any]         =  same_length

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

   __lowerCAmelCase	:			str         =  bos_token_id
   __lowerCAmelCase	:			Any         =  pad_token_id
   __lowerCAmelCase	:			Optional[int]         =  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	:			List[str]         =  kwargs["""use_cache"""]

   __lowerCAmelCase	:			Union[str, Any]         =  use_mems_eval
   __lowerCAmelCase	:			int         =  use_mems_train
   super().__init__(pad_token_id=__lowerCAmelCase  ,    bos_token_id=__lowerCAmelCase  ,    eos_token_id=__lowerCAmelCase  ,    **__lowerCAmelCase     )






  @property
  def  UpperCAmelCase__		(				self					:	Optional[Any]     )->Union[str, 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  UpperCAmelCase__		(				self					:	Tuple  ,    _snake_case					:	Optional[Any]     )->Dict:






   '''simple docstring'''

   raise NotImplementedError(
       F'''The model {self.model_type} is one of the few models that has no sequence length limit.'''     )




def 	SCREAMING_SNAKE_CASE_							(	_snake_case	:list				)  ->     bool:
   if not isinstance(_snake_case	,   _snake_case				):
      raise ValueError('''Input series is not valid, valid series - [2, 4, 6]'''				)
   if len(_snake_case				) == 0:
      raise ValueError('''Input list must be a non empty list'''				)
   if len(_snake_case				) == 1:
      return True
   _A      =       series[1] - series[0]
   for index in range(len(_snake_case				) - 1				):
      if series[index + 1] - series[index] != common_diff:
         return False
   return True

def 	SCREAMING_SNAKE_CASE_							(	_snake_case	:list				)  ->     float:
   if not isinstance(_snake_case	,   _snake_case				):
      raise ValueError('''Input series is not valid, valid series - [2, 4, 6]'''				)
   if len(_snake_case				) == 0:
      raise ValueError('''Input list must be a non empty list'''				)
   _A      =       0
   for val in series:
      answer += val
   return answer / len(_snake_case				)


if __name__ == "__main__":
   import doctest

   doctest.testmod()



