

"""simple docstring"""






import warnings

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


_lowerCAmelCase						=		logging.get_logger(__name__)

_lowerCAmelCase						=		{
    """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__						):
  _UpperCAmelCase          =		"xlnet"
  _UpperCAmelCase          =		["mems"]
  _UpperCAmelCase          =		{
      "n_token": "vocab_size",  # Backward compatibility
      "hidden_size": "d_model",
      "num_attention_heads": "n_head",
      "num_hidden_layers": "n_layer",
  }

  def __init__(		self    ,_A=3_2000    ,_A=1024    ,_A=24    ,_A=16    ,_A=4096    ,_A="gelu"    ,_A=True    ,_A="bi"    ,_A=0.0_2    ,_A=1E-12    ,_A=0.1    ,_A=512    ,_A=None    ,_A=True    ,_A=False    ,_A=False    ,_A=-1    ,_A=False    ,_A="last"    ,_A=True    ,_A="tanh"    ,_A=0.1    ,_A=5    ,_A=5    ,_A=5    ,_A=1    ,_A=2    ,**_A    ,):
      '''simple docstring'''

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

      _lowerCAmelCase       :   Tuple  =    initializer_range
      _lowerCAmelCase       :   Tuple  =    layer_norm_eps

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

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

      _lowerCAmelCase       :   Dict  =    bos_token_id
      _lowerCAmelCase       :   List[Any]  =    pad_token_id
      _lowerCAmelCase       :   Any  =    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.'    ,_A    ,)
          _lowerCAmelCase       :   List[Any]  =    kwargs['use_cache']

      _lowerCAmelCase       :   str  =    use_mems_eval
      _lowerCAmelCase       :   Optional[int]  =    use_mems_train
      super().__init__(pad_token_id=_A    ,bos_token_id=_A    ,eos_token_id=_A    ,**_A      )

  @property
  def __lowerCamelCase		(		self      ):
      '''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 __lowerCamelCase		(		self    ,_A      ):
      '''simple docstring'''

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








"""simple docstring"""






import baseaa

def 		lowerCamelCase__		(					_lowerCamelCase   ):

    '''simple docstring'''



    return baseaa.aaaencode(string.encode('utf-8'   )   )

def 		lowerCamelCase__		(					_lowerCamelCase   ):

    '''simple docstring'''



    return baseaa.aaadecode(_lowerCamelCase   ).decode('utf-8'   )


if __name__ == "__main__":
 import doctest

 doctest.testmod()





