
import warnings

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


lowerCamelCase_    :			Any    =	logging.get_logger(__name__)

lowerCamelCase_    :			List[str]    =	{
    '''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_	):






			'''simple docstring'''

			__UpperCamelCase   :    Any          =			"""xlnet"""
			__UpperCamelCase   :    Optional[Any]          =			["""mems"""]
			__UpperCamelCase   :    Union[str, Any]          =			{
			    """n_token""": """vocab_size""",  # Backward compatibility
			    """hidden_size""": """d_model""",
			    """num_attention_heads""": """n_head""",
			    """num_hidden_layers""": """n_layer""",
			}

			def __init__(							self			:							Tuple    ,						snake_case_			:							int=3_2000    ,						snake_case_			:							List[str]=1024    ,						snake_case_			:							str=24    ,						snake_case_			:							str=16    ,						snake_case_			:							int=4096    ,						snake_case_			:							Optional[Any]="gelu"    ,						snake_case_			:							Optional[Any]=True    ,						snake_case_			:							List[Any]="bi"    ,						snake_case_			:							Optional[Any]=0.02    ,						snake_case_			:							Tuple=1e-12    ,						snake_case_			:							str=0.1    ,						snake_case_			:							Optional[Any]=512    ,						snake_case_			:							Optional[Any]=None    ,						snake_case_			:							Optional[Any]=True    ,						snake_case_			:							List[str]=False    ,						snake_case_			:							List[Any]=False    ,						snake_case_			:							Any=-1    ,						snake_case_			:							List[str]=False    ,						snake_case_			:							int="last"    ,						snake_case_			:							Union[str, Any]=True    ,						snake_case_			:							List[Any]="tanh"    ,						snake_case_			:							List[str]=0.1    ,						snake_case_			:							int=5    ,						snake_case_			:							List[Any]=5    ,						snake_case_			:							Dict=5    ,						snake_case_			:							int=1    ,						snake_case_			:							Optional[int]=2    ,						**snake_case_			:							Dict    ,						):
							UpperCamelCase_:				List[str]						=    vocab_size
							UpperCamelCase_:				Dict						=    d_model
							UpperCamelCase_:				Optional[int]						=    n_layer
							UpperCamelCase_:				Dict						=    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_:				Union[str, Any]						=    d_model // n_head
							UpperCamelCase_:				Tuple						=    ff_activation
							UpperCamelCase_:				Tuple						=    d_inner
							UpperCamelCase_:				List[str]						=    untie_r
							UpperCamelCase_:				Dict						=    attn_type

							UpperCamelCase_:				List[Any]						=    initializer_range
							UpperCamelCase_:				int						=    layer_norm_eps

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

							UpperCamelCase_:				Optional[int]						=    summary_type
							UpperCamelCase_:				Union[str, Any]						=    summary_use_proj
							UpperCamelCase_:				int						=    summary_activation
							UpperCamelCase_:				str						=    summary_last_dropout
							UpperCamelCase_:				Dict						=    start_n_top
							UpperCamelCase_:				Union[str, Any]						=    end_n_top

							UpperCamelCase_:				List[Any]						=    bos_token_id
							UpperCamelCase_:				Tuple						=    pad_token_id
							UpperCamelCase_:				Optional[int]						=    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_:				Union[str, Any]						=    use_mems_eval
							UpperCamelCase_:				Any						=    use_mems_train
							super().__init__(pad_token_id=__UpperCamelCase    ,						bos_token_id=__UpperCamelCase    ,						eos_token_id=__UpperCamelCase    ,						**__UpperCamelCase   )

			@property
			def    lowerCAmelCase__						(							self			:							Union[str, Any]   ):
							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			:							str    ,						snake_case_			:							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.'''   )














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





def    __lowerCAmelCase   (    __snake_case       ,			__snake_case       ,			__snake_case							):
     __lowerCAmelCase             =       from_type.lower().strip("s"							)
     __lowerCAmelCase             =       to_type.lower().strip("s"							)

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

     if from_sanitized not in METRIC_CONVERSION:
          __lowerCAmelCase             =       (
              F"""Invalid 'from_type' value: {from_type!r}.\n"""
              F"""Conversion abbreviations are: {", ".join(__snake_case							)}"""
          )
          raise ValueError(__snake_case							)
     if to_sanitized not in METRIC_CONVERSION:
          __lowerCAmelCase             =       (
              F"""Invalid 'to_type' value: {to_type!r}.\n"""
              F"""Conversion abbreviations are: {", ".join(__snake_case							)}"""
          )
          raise ValueError(__snake_case							)
     __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       ,			__snake_case							)


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

 testmod()






