


import warnings

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


SCREAMING_SNAKE_CASE			: int				   =					logging.get_logger(__name__)

SCREAMING_SNAKE_CASE			: Tuple				   =					{
    "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 _lowerCamelCase(		_a  ):
       lowercase_					:      Dict       					=     """xlnet"""
       lowercase_					:      Tuple       					=     ["""mems"""]
       lowercase_					:      List[Any]       					=     {
           """n_token""": """vocab_size""",  # Backward compatibility
           """hidden_size""": """d_model""",
           """num_attention_heads""": """n_head""",
           """num_hidden_layers""": """n_layer""",
       }
       def __init__(   self, lowerCamelCase=3_20_00, lowerCamelCase=10_24, lowerCamelCase=24, lowerCamelCase=16, lowerCamelCase=40_96, lowerCamelCase="gelu", lowerCamelCase=True, lowerCamelCase="bi", lowerCamelCase=0.0_2, lowerCamelCase=1E-12, lowerCamelCase=0.1, lowerCamelCase=5_12, lowerCamelCase=None, lowerCamelCase=True, lowerCamelCase=False, lowerCamelCase=False, lowerCamelCase=-1, lowerCamelCase=False, lowerCamelCase="last", lowerCamelCase=True, lowerCamelCase="tanh", lowerCamelCase=0.1, lowerCamelCase=5, lowerCamelCase=5, lowerCamelCase=5, lowerCamelCase=1, lowerCamelCase=2, **lowerCamelCase, )			->  Union[str, Any]:




           """simple docstring"""

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

           _lowercase			:				Optional[Any] 						=						initializer_range
           _lowercase			:				List[Any] 						=						layer_norm_eps

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

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

           _lowercase			:				int 						=						bos_token_id
           _lowercase			:				List[Any] 						=						pad_token_id
           _lowercase			:				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.', lowerCamelCase, )
               _lowercase			:				Dict 						=						kwargs['use_cache']

           _lowercase			:				str 						=						use_mems_eval
           _lowercase			:				Tuple 						=						use_mems_train
           super().__init__(pad_token_id=lowerCamelCase, bos_token_id=lowerCamelCase, eos_token_id=lowerCamelCase, **lowerCamelCase)
       @property
       def      UpperCamelCase	(   self)			->  Optional[int]:




           """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      UpperCamelCase	(   self, lowerCamelCase)			->  Union[str, Any]:




           """simple docstring"""

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






def 							UpperCamelCase_( lowerCamelCase_					)       ->		int:

    if not isinstance(lowerCamelCase_				,					lowerCamelCase_					):
        raise ValueError('multiplicative_persistence() only accepts integral values'					)
    if num < 0:
        raise ValueError('multiplicative_persistence() does not accept negative values'					)

    _lowercase			:				List[str] 						=						0
    _lowercase			:				Optional[int] 						=						str(lowerCamelCase_					)

    while len(lowerCamelCase_					) != 1:
        _lowercase			:				Any 						=						[int(lowerCamelCase_					) for i in num_string]

        _lowercase			:				List[Any] 						=						1
        for i in range(0				,					len(lowerCamelCase_					)					):
            total *= numbers[i]

        _lowercase			:				Optional[Any] 						=						str(lowerCamelCase_					)

        steps += 1
    return steps



def 							UpperCamelCase_( lowerCamelCase_					)       ->		int:

    if not isinstance(lowerCamelCase_				,					lowerCamelCase_					):
        raise ValueError('additive_persistence() only accepts integral values'					)
    if num < 0:
        raise ValueError('additive_persistence() does not accept negative values'					)

    _lowercase			:				Optional[int] 						=						0
    _lowercase			:				str 						=						str(lowerCamelCase_					)

    while len(lowerCamelCase_					) != 1:
        _lowercase			:				Dict 						=						[int(lowerCamelCase_					) for i in num_string]

        _lowercase			:				Any 						=						0
        for i in range(0				,					len(lowerCamelCase_					)					):
            total += numbers[i]

        _lowercase			:				Dict 						=						str(lowerCamelCase_					)

        steps += 1
    return steps


if __name__ == "__main__":
 import doctest

 doctest.testmod()


