





"""simple docstring"""




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


_snake_case  :   Dict						   =  logging.get_logger(__name__)

_snake_case  :   Optional[int]						   =  {
    '''transfo-xl-wt103''': '''https://huggingface.co/transfo-xl-wt103/resolve/main/config.json''',
}



class     _UpperCAmelCase   (   a__   ):

  """simple docstring"""


  a_      =			'transfo-xl'
  a_      =			['mems']
  a_      =			{
      'n_token': 'vocab_size',
      'hidden_size': 'd_model',
      'num_attention_heads': 'n_head',
      'num_hidden_layers': 'n_layer',
  }






  def __init__(    self			:		Tuple ,  lowerCAmelCase_			:		Dict=2_6_7_7_3_5 ,  lowerCAmelCase_			:		int=[2_0_0_0_0, 4_0_0_0_0, 2_0_0_0_0_0] ,  lowerCAmelCase_			:		List[str]=1_0_2_4 ,  lowerCAmelCase_			:		int=1_0_2_4 ,  lowerCAmelCase_			:		Optional[Any]=1_6 ,  lowerCAmelCase_			:		Optional[Any]=6_4 ,  lowerCAmelCase_			:		Optional[Any]=4_0_9_6 ,  lowerCAmelCase_			:		Optional[int]=4 ,  lowerCAmelCase_			:		str=False ,  lowerCAmelCase_			:		Optional[Any]=1_8 ,  lowerCAmelCase_			:		Any=1_6_0_0 ,  lowerCAmelCase_			:		List[Any]=1_0_0_0 ,  lowerCAmelCase_			:		List[Any]=True ,  lowerCAmelCase_			:		List[str]=True ,  lowerCAmelCase_			:		Union[str, Any]=0 ,  lowerCAmelCase_			:		List[str]=-1 ,  lowerCAmelCase_			:		Tuple=True ,  lowerCAmelCase_			:		Tuple=0.1 ,  lowerCAmelCase_			:		int=0.0 ,  lowerCAmelCase_			:		int=True ,  lowerCAmelCase_			:		Union[str, Any]="normal" ,  lowerCAmelCase_			:		Optional[Any]=0.01 ,  lowerCAmelCase_			:		Union[str, Any]=0.01 ,  lowerCAmelCase_			:		Dict=0.02 ,  lowerCAmelCase_			:		Optional[Any]=1e-5 ,  lowerCAmelCase_			:		Tuple=0 ,  **lowerCAmelCase_			:		List[Any] ,  )							->						int:
     __lowerCAmelCase							     =     vocab_size
     __lowerCAmelCase							     =     []
     self.cutoffs.extend(_lowerCamelCase					)
     if proj_share_all_but_first:
        __lowerCAmelCase							     =     [False] + [True] * len(self.cutoffs					)
     else:
        __lowerCAmelCase							     =     [False] + [False] * len(self.cutoffs					)
     __lowerCAmelCase							     =     d_model
     __lowerCAmelCase							     =     d_embed
     __lowerCAmelCase							     =     d_head
     __lowerCAmelCase							     =     d_inner
     __lowerCAmelCase							     =     div_val
     __lowerCAmelCase							     =     pre_lnorm
     __lowerCAmelCase							     =     n_layer
     __lowerCAmelCase							     =     n_head
     __lowerCAmelCase							     =     mem_len
     __lowerCAmelCase							     =     same_length
     __lowerCAmelCase							     =     attn_type
     __lowerCAmelCase							     =     clamp_len
     __lowerCAmelCase							     =     sample_softmax
     __lowerCAmelCase							     =     adaptive
     __lowerCAmelCase							     =     dropout
     __lowerCAmelCase							     =     dropatt
     __lowerCAmelCase							     =     untie_r
     __lowerCAmelCase							     =     init
     __lowerCAmelCase							     =     init_range
     __lowerCAmelCase							     =     proj_init_std
     __lowerCAmelCase							     =     init_std
     __lowerCAmelCase							     =     layer_norm_epsilon
     super().__init__(eos_token_id=_lowerCamelCase ,  **_lowerCamelCase					)






  @property
  def     lowercase		(    self			:		List[str]					)							->						Dict:
     # Message copied from Transformer-XL documentation
     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[Any] ,  lowerCAmelCase_			:		List[Any]					)							->						Union[str, Any]:
     # 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."""					)








_snake_case  :   List[str]						   =  {
    'meter': 'm',
    'kilometer': 'km',
    'megametre': 'Mm',
    'gigametre': 'Gm',
    'terametre': 'Tm',
    'petametre': 'Pm',
    'exametre': 'Em',
    'zettametre': 'Zm',
    'yottametre': 'Ym',
}
# Exponent of the factor(meter)
_snake_case  :   List[Any]						   =  {
    'm': 0,
    'km': 3,
    'Mm': 6,
    'Gm': 9,
    'Tm': 12,
    'Pm': 15,
    'Em': 18,
    'Zm': 21,
    'Ym': 24,
}

def   a_   (			lowerCAmelCase_				:      float,     lowerCAmelCase_				:      str,     lowerCAmelCase_				:      str     ):
   __lowerCAmelCase							     =     from_type.lower().strip('s'     )
   __lowerCAmelCase							     =     to_type.lower().strip('s'     )

   __lowerCAmelCase							     =     UNIT_SYMBOL.get(lowerCAmelCase_,     lowerCAmelCase_     )
   __lowerCAmelCase							     =     UNIT_SYMBOL.get(lowerCAmelCase_,     lowerCAmelCase_     )

   if from_sanitized not in METRIC_CONVERSION:
      __lowerCAmelCase							     =     (
          F"""Invalid 'from_type' value: {from_type!r}.\n"""
          F"""Conversion abbreviations are: {", ".join(lowerCAmelCase_     )}"""
      )
      raise ValueError(lowerCAmelCase_     )
   if to_sanitized not in METRIC_CONVERSION:
      __lowerCAmelCase							     =     (
          F"""Invalid 'to_type' value: {to_type!r}.\n"""
          F"""Conversion abbreviations are: {", ".join(lowerCAmelCase_     )}"""
      )
      raise ValueError(lowerCAmelCase_     )
   __lowerCAmelCase							     =     METRIC_CONVERSION[from_sanitized]
   __lowerCAmelCase							     =     METRIC_CONVERSION[to_sanitized]
   __lowerCAmelCase							     =     1

   if from_exponent > to_exponent:
      __lowerCAmelCase							     =     from_exponent - to_exponent
   else:
      __lowerCAmelCase							     =     -(to_exponent - from_exponent)

   return value * pow(10,     lowerCAmelCase_     )


if __name__ == "__main__":
     from doctest import testmod

     testmod()

