"""simple docstring"""






import warnings

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


__A       =					logging.get_logger(__name__)

__A       =					{
    "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		(snake_case_    ):



    """simple docstring"""

    _UpperCAmelCase      :List[Any]		       =					"xlnet"
    _UpperCAmelCase      :Tuple		       =					["mems"]
    _UpperCAmelCase      :Optional[Any]		       =					{
        "n_token": "vocab_size",  # Backward compatibility
        "hidden_size": "d_model",
        "num_attention_heads": "n_head",
        "num_hidden_layers": "n_layer",
    }






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

       lowercase__:  str   = initializer_range
       lowercase__:  List[str]   = layer_norm_eps

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

       lowercase__:  Union[str, Any]   = summary_type
       lowercase__:  List[Any]   = summary_use_proj
       lowercase__:  Tuple   = summary_activation
       lowercase__:  str   = summary_last_dropout
       lowercase__:  Optional[Any]   = start_n_top
       lowercase__:  List[Any]   = end_n_top

       lowercase__:  List[str]   = bos_token_id
       lowercase__:  List[str]   = pad_token_id
       lowercase__:  str   = 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.'''       ,     _UpperCAmelCase       ,     )
          lowercase__:  Optional[int]   = kwargs['''use_cache''']

       lowercase__:  Tuple   = use_mems_eval
       lowercase__:  List[str]   = use_mems_train
       super().__init__(pad_token_id=_UpperCAmelCase       ,     bos_token_id=_UpperCAmelCase       ,     eos_token_id=_UpperCAmelCase       ,     **_UpperCAmelCase				)






    @property
    def _snake_case     (  self				):
       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       ,     _UpperCAmelCase				):
       # 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."""				)








import copy
from dataclasses import dataclass
from pathlib import Path
from typing import Dict, Optional, Union




@dataclass
class 					UpperCamelCase_ :



	'''simple docstring'''




	lowerCAmelCase						=					None
	lowerCAmelCase						=					False
	lowerCAmelCase						=					False
	lowerCAmelCase						=					False
	lowerCAmelCase						=					None
	lowerCAmelCase						=					None
	lowerCAmelCase						=					False
	lowerCAmelCase						=					False
	lowerCAmelCase						=					False
	lowerCAmelCase						=					True
	lowerCAmelCase						=					None
	lowerCAmelCase						=					1
	lowerCAmelCase						=					None
	lowerCAmelCase						=					False
	lowerCAmelCase						=					None
	lowerCAmelCase						=					None




	def 				_UpperCamelCase     (			self   )			->       "DownloadConfig":
								return self.__class__(**{k: copy.deepcopy(a   ) for k, v in self.__dict__.items()}   )





