


'''simple docstring'''
import warnings

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


__snake_case							   =  logging.get_logger(__name__)

__snake_case							   =  {
    '''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      lowercase			(							A__      ):

		"""simple docstring"""

		_a									=       'xlnet'
		_a									=       ['mems']
		_a									=       {
		    '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-12					,     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_					,     ):

							'''simple docstring'''


							UpperCamelCase__     :Dict							      =				vocab_size
							UpperCamelCase__     :Any							      =				d_model
							UpperCamelCase__     :Optional[Any]							      =				n_layer
							UpperCamelCase__     :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})'''							)
							UpperCamelCase__     :int							      =				d_model // n_head
							UpperCamelCase__     :List[Any]							      =				ff_activation
							UpperCamelCase__     :Tuple							      =				d_inner
							UpperCamelCase__     :Union[str, Any]							      =				untie_r
							UpperCamelCase__     :Optional[Any]							      =				attn_type

							UpperCamelCase__     :Optional[int]							      =				initializer_range
							UpperCamelCase__     :Union[str, Any]							      =				layer_norm_eps

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

							UpperCamelCase__     :str							      =				summary_type
							UpperCamelCase__     :List[Any]							      =				summary_use_proj
							UpperCamelCase__     :Tuple							      =				summary_activation
							UpperCamelCase__     :List[str]							      =				summary_last_dropout
							UpperCamelCase__     :Dict							      =				start_n_top
							UpperCamelCase__     :List[Any]							      =				end_n_top

							UpperCamelCase__     :Union[str, Any]							      =				bos_token_id
							UpperCamelCase__     :int							      =				pad_token_id
							UpperCamelCase__     :Optional[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.'''					,     UpperCamelCase_					,     )
												UpperCamelCase__     :Any							      =				kwargs['''use_cache''']

							UpperCamelCase__     :Optional[Any]							      =				use_mems_eval
							UpperCamelCase__     :Dict							      =				use_mems_train
							super().__init__(pad_token_id=UpperCamelCase_					,     bos_token_id=UpperCamelCase_					,     eos_token_id=UpperCamelCase_					,     **UpperCamelCase_							)




		@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					,     UpperCamelCase_							):

							'''simple docstring'''


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



'''simple docstring'''
from __future__ import annotations

from decimal import Decimal
from math import *  # noqa: F403

from sympy import diff


def     a   (    __a				,      __a				,      __a = 10**-10     )						->			float:



					'''simple docstring'''






					UpperCamelCase__     :Tuple							      =				a
					while True:
										UpperCamelCase__     :Dict							      =				Decimal(__a     ) - (
										    Decimal(eval(__a     )     ) / Decimal(eval(str(diff(__a     )     )     )     )  # noqa: S307
										)
										# This number dictates the accuracy of the answer
										if abs(eval(__a     )     ) < precision:  # noqa: S307
															return float(__a     )


# Let's Execute
if __name__ == "__main__":
		# Find root of trigonometric function
		# Find value of pi
		print(F"""The root of sin(x) = 0 is {newton_raphson('sin(x)', 2)}""")
		# Find root of polynomial
		print(F"""The root of x**2 - 5*x + 2 = 0 is {newton_raphson('x**2 - 5*x + 2', 0.4)}""")
		# Find Square Root of 5
		print(F"""The root of log(x) - 1 = 0 is {newton_raphson('log(x) - 1', 2)}""")
		# Exponential Roots
		print(F"""The root of exp(x) - 1 = 0 is {newton_raphson('exp(x) - 1', 0)}""")