

"""simple docstring"""




import warnings

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


A_				:      Dict           =			logging.get_logger(__name__)

A_				:      Optional[int]           =			{
    "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__      ):
			lowerCamelCase__ :		Optional[int]       		=				'xlnet'
			lowerCamelCase__ :		Union[str, Any]       		=				['mems']
			lowerCamelCase__ :		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					:    str     ,					__UpperCAmelCase					:    Any=3_2_0_0_0     ,					__UpperCAmelCase					:    Tuple=1_0_2_4     ,					__UpperCAmelCase					:    Any=2_4     ,					__UpperCAmelCase					:    Any=1_6     ,					__UpperCAmelCase					:    Optional[int]=4_0_9_6     ,					__UpperCAmelCase					:    str="gelu"     ,					__UpperCAmelCase					:    List[str]=True     ,					__UpperCAmelCase					:    Optional[int]="bi"     ,					__UpperCAmelCase					:    Tuple=0.02     ,					__UpperCAmelCase					:    int=1e-12     ,					__UpperCAmelCase					:    Dict=0.1     ,					__UpperCAmelCase					:    Tuple=5_1_2     ,					__UpperCAmelCase					:    Union[str, Any]=None     ,					__UpperCAmelCase					:    Optional[Any]=True     ,					__UpperCAmelCase					:    List[str]=False     ,					__UpperCAmelCase					:    List[str]=False     ,					__UpperCAmelCase					:    int=-1     ,					__UpperCAmelCase					:    List[str]=False     ,					__UpperCAmelCase					:    int="last"     ,					__UpperCAmelCase					:    Dict=True     ,					__UpperCAmelCase					:    Dict="tanh"     ,					__UpperCAmelCase					:    List[str]=0.1     ,					__UpperCAmelCase					:    int=5     ,					__UpperCAmelCase					:    Optional[int]=5     ,					__UpperCAmelCase					:    str=5     ,					__UpperCAmelCase					:    Any=1     ,					__UpperCAmelCase					:    int=2     ,					**__UpperCAmelCase					:    Any     ,					) ->     Optional[int]:
						SCREAMING_SNAKE_CASE__										=   vocab_size
						SCREAMING_SNAKE_CASE__										=   d_model
						SCREAMING_SNAKE_CASE__										=   n_layer
						SCREAMING_SNAKE_CASE__										=   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})"""							)
						SCREAMING_SNAKE_CASE__										=   d_model // n_head
						SCREAMING_SNAKE_CASE__										=   ff_activation
						SCREAMING_SNAKE_CASE__										=   d_inner
						SCREAMING_SNAKE_CASE__										=   untie_r
						SCREAMING_SNAKE_CASE__										=   attn_type

						SCREAMING_SNAKE_CASE__										=   initializer_range
						SCREAMING_SNAKE_CASE__										=   layer_norm_eps

						SCREAMING_SNAKE_CASE__										=   dropout
						SCREAMING_SNAKE_CASE__										=   mem_len
						SCREAMING_SNAKE_CASE__										=   reuse_len
						SCREAMING_SNAKE_CASE__										=   bi_data
						SCREAMING_SNAKE_CASE__										=   clamp_len
						SCREAMING_SNAKE_CASE__										=   same_length

						SCREAMING_SNAKE_CASE__										=   summary_type
						SCREAMING_SNAKE_CASE__										=   summary_use_proj
						SCREAMING_SNAKE_CASE__										=   summary_activation
						SCREAMING_SNAKE_CASE__										=   summary_last_dropout
						SCREAMING_SNAKE_CASE__										=   start_n_top
						SCREAMING_SNAKE_CASE__										=   end_n_top

						SCREAMING_SNAKE_CASE__										=   bos_token_id
						SCREAMING_SNAKE_CASE__										=   pad_token_id
						SCREAMING_SNAKE_CASE__										=   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     ,					)
									SCREAMING_SNAKE_CASE__										=   kwargs["""use_cache"""]

						SCREAMING_SNAKE_CASE__										=   use_mems_eval
						SCREAMING_SNAKE_CASE__										=   use_mems_train
						super().__init__(pad_token_id=__UpperCAmelCase     ,					bos_token_id=__UpperCAmelCase     ,					eos_token_id=__UpperCAmelCase     ,					**__UpperCAmelCase							)

			@property
			def        SCREAMING_SNAKE_CASE					(       self					:    List[Any]							) ->     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        SCREAMING_SNAKE_CASE					(       self					:    Optional[Any]     ,					__UpperCAmelCase					:    List[str]							) ->     List[str]:
						# 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."""							)





"""simple docstring"""




# flake8: noqa
# Lint as: python3
A_				:      List[str]           =			[
    "VerificationMode",
    "Version",
    "disable_progress_bar",
    "enable_progress_bar",
    "is_progress_bar_enabled",
    "experimental",
]

from .info_utils import VerificationMode
from .logging import disable_progress_bar, enable_progress_bar, is_progress_bar_enabled
from .version import Version
from .experimental import experimental


