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


_A  =	logging.get_logger(__name__)

_A  =	{
    "transfo-xl-wt103": "https://huggingface.co/transfo-xl-wt103/resolve/main/config.json",
}





class       _lowerCAmelCase   (      __a			):
				_lowercase     						='''transfo-xl'''
				_lowercase     						=['''mems''']
				_lowercase     						={
				    '''n_token''': '''vocab_size''',
				    '''hidden_size''': '''d_model''',
				    '''num_attention_heads''': '''n_head''',
				    '''num_hidden_layers''': '''n_layer''',
				}




				def __init__(   self							,							_UpperCamelCase=267_735							,							_UpperCamelCase=[20_000, 40_000, 200_000]							,							_UpperCamelCase=1_024							,							_UpperCamelCase=1_024							,							_UpperCamelCase=16							,							_UpperCamelCase=64							,							_UpperCamelCase=4_096							,							_UpperCamelCase=4							,							_UpperCamelCase=False							,							_UpperCamelCase=18							,							_UpperCamelCase=1_600							,							_UpperCamelCase=1_000							,							_UpperCamelCase=True							,							_UpperCamelCase=True							,							_UpperCamelCase=0							,							_UpperCamelCase=-1							,							_UpperCamelCase=True							,							_UpperCamelCase=0.1							,							_UpperCamelCase=0.0							,							_UpperCamelCase=True							,							_UpperCamelCase="normal"							,							_UpperCamelCase=0.01							,							_UpperCamelCase=0.01							,							_UpperCamelCase=0.02							,							_UpperCamelCase=1e-5							,							_UpperCamelCase=0							,							**_UpperCamelCase							,							)							-> Optional[Any]:
							lowerCAmelCase_         =      vocab_size
							lowerCAmelCase_         =      []
							self.cutoffs.extend(_UpperCamelCase	)
							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=_UpperCamelCase							,							**_UpperCamelCase	)




				@property
				def 	__a		(   self	)							-> 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 	__a		(   self							,							_UpperCamelCase	)							-> List[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."""	)





from collections.abc import Callable






def   lowerCamelCase__							(							__lowerCAmelCase    :    Callable[[float], float]       ,				__lowerCAmelCase    :    float       ,				__lowerCAmelCase    :    float							):




			"""simple docstring"""


			lowerCAmelCase_         =      a
			lowerCAmelCase_         =      b
			if function(__lowerCAmelCase							) == 0:  # one of the a or b is a root for the function
						return a
			elif function(__lowerCAmelCase							) == 0:
						return b
			elif (
			    function(__lowerCAmelCase							) * function(__lowerCAmelCase							) > 0
			):  # if none of these are root and they are both positive or negative,
						# then this algorithm can't find the root
						raise ValueError("could not find root in given interval."							)
			else:
						lowerCAmelCase_         =      start + (end - start) / 2.0
						while abs(start - mid							) > 10**-7:  # until precisely equals to 10^-7
									if function(__lowerCAmelCase							) == 0:
												return mid
									elif function(__lowerCAmelCase							) * function(__lowerCAmelCase							) < 0:
												lowerCAmelCase_         =      mid
									else:
												lowerCAmelCase_         =      mid
									lowerCAmelCase_         =      start + (end - start) / 2.0
						return mid






def   lowerCamelCase__							(							__lowerCAmelCase    :    float							):




			"""simple docstring"""


			return x**3 - 2 * x - 5


if __name__ == "__main__":
			print(bisection(f, 1, 10_00))

			import doctest

			doctest.testmod()



