


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


snake_case							: Any      =   logging.get_logger(__name__)

snake_case							: Dict      =   {
    '''transfo-xl-wt103''': '''https://huggingface.co/transfo-xl-wt103/resolve/main/config.json''',
}







class  snake_case_     (lowerCamelCase_   ):
					UpperCAmelCase__      :					List[Any]					   =    '''transfo-xl'''
					UpperCAmelCase__      :					Dict					   =    ['''mems''']
					UpperCAmelCase__      :					Union[str, Any]					   =    {
					    '''n_token''': '''vocab_size''',
					    '''hidden_size''': '''d_model''',
					    '''num_attention_heads''': '''n_head''',
					    '''num_hidden_layers''': '''n_layer''',
					}
					def __init__(   self     :Optional[Any]    ,__snake_case     :Any=26_77_35    ,__snake_case     :Optional[int]=[2_00_00, 4_00_00, 20_00_00]    ,__snake_case     :Tuple=10_24    ,__snake_case     :Optional[Any]=10_24    ,__snake_case     :Optional[Any]=16    ,__snake_case     :Optional[int]=64    ,__snake_case     :str=40_96    ,__snake_case     :Optional[int]=4    ,__snake_case     :Optional[Any]=False    ,__snake_case     :int=18    ,__snake_case     :List[Any]=16_00    ,__snake_case     :Optional[Any]=10_00    ,__snake_case     :Optional[Any]=True    ,__snake_case     :Dict=True    ,__snake_case     :Optional[int]=0    ,__snake_case     :List[Any]=-1    ,__snake_case     :Any=True    ,__snake_case     :int=0.1    ,__snake_case     :Any=0.0    ,__snake_case     :Optional[Any]=True    ,__snake_case     :Union[str, Any]="normal"    ,__snake_case     :Any=0.01    ,__snake_case     :int=0.01    ,__snake_case     :str=0.02    ,__snake_case     :Any=1E-5    ,__snake_case     :Any=0    ,**__snake_case     :Any    ,)      ->					List[str]:
												a__    =  vocab_size
												a__    =  []
												self.cutoffs.extend(__snake_case   )
												if proj_share_all_but_first:
																			a__    =  [False] + [True] * len(self.cutoffs   )
												else:
																			a__    =  [False] + [False] * len(self.cutoffs   )
												a__    =  d_model
												a__    =  d_embed
												a__    =  d_head
												a__    =  d_inner
												a__    =  div_val
												a__    =  pre_lnorm
												a__    =  n_layer
												a__    =  n_head
												a__    =  mem_len
												a__    =  same_length
												a__    =  attn_type
												a__    =  clamp_len
												a__    =  sample_softmax
												a__    =  adaptive
												a__    =  dropout
												a__    =  dropatt
												a__    =  untie_r
												a__    =  init
												a__    =  init_range
												a__    =  proj_init_std
												a__    =  init_std
												a__    =  layer_norm_epsilon
												super().__init__(eos_token_id=__snake_case    ,**__snake_case   )
					@property
					def 				lowerCamelCase__(   self     :Optional[Any]   )      ->					Optional[int]:
												# 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 				lowerCamelCase__(   self     :Optional[Any]    ,__snake_case     :Any   )      ->					Tuple:
												# 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.'   )








from decimal import Decimal, getcontext
from math import ceil, factorial






def 							__lowercase     (				__lowerCAmelCase							:       int     ):

							if not isinstance(__lowerCAmelCase      ,					__lowerCAmelCase     ):
														raise TypeError('Undefined for non-integers'     )
							elif precision < 1:
														raise ValueError('Undefined for non-natural numbers'     )

							a__    =  precision
							a__    =  ceil(precision / 1_4     )
							a__    =  4_2_6_8_8_0 * Decimal(1_0_0_0_5     ).sqrt()
							a__    =  1
							a__    =  1_3_5_9_1_4_0_9
							a__    =  Decimal(__lowerCAmelCase     )
							for k in range(1      ,					__lowerCAmelCase     ):
														a__    =  factorial(6 * k     ) // (factorial(3 * k     ) * factorial(__lowerCAmelCase     ) ** 3)
														linear_term += 5_4_5_1_4_0_1_3_4
														exponential_term *= -2_6_2_5_3_7_4_1_2_6_4_0_7_6_8_0_0_0
														partial_sum += Decimal(multinomial_term * linear_term     ) / exponential_term
							return str(constant_term / partial_sum     )[:-1]


if __name__ == "__main__":
						snake_case							: Tuple      =   50
						print(f"""The first {n} digits of pi is: {pi(n)}""")




