import warnings

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


A__           =							logging.get_logger(__name__)

A__           =							{
    """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		(     __SCREAMING_SNAKE_CASE				):
							_UpperCAmelCase						    =     'xlnet'
							_UpperCAmelCase						    =     ['mems']
							_UpperCAmelCase						    =     {
							    'n_token': 'vocab_size',  # Backward compatibility
							    'hidden_size': 'd_model',
							    'num_attention_heads': 'n_head',
							    'num_hidden_layers': 'n_layer',
							}







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

										lowerCamelCase						:Optional[Any]						  =     initializer_range
										lowerCamelCase						:Dict						  =     layer_norm_eps

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

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

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

										lowerCamelCase						:Optional[int]						  =     use_mems_eval
										lowerCamelCase						:Optional[int]						  =     use_mems_train
										super().__init__(pad_token_id=__snake_case	,					bos_token_id=__snake_case	,					eos_token_id=__snake_case	,					**__snake_case		)







							@property
							def 				snake_case  (				self     :    Dict		):
										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 				snake_case  (				self     :    Optional[Any]	,					__snake_case     :    int		):
										# 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 typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


A__           =							{
    """configuration_nllb_moe""": [
        """NLLB_MOE_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """NllbMoeConfig""",
    ]
}

try:
			if not is_torch_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			A__           =							[
			    """NLLB_MOE_PRETRAINED_MODEL_ARCHIVE_LIST""",
			    """NllbMoeForConditionalGeneration""",
			    """NllbMoeModel""",
			    """NllbMoePreTrainedModel""",
			    """NllbMoeTop2Router""",
			    """NllbMoeSparseMLP""",
			]


if TYPE_CHECKING:
			from .configuration_nllb_moe import (
			    NLLB_MOE_PRETRAINED_CONFIG_ARCHIVE_MAP,
			    NllbMoeConfig,
			)

			try:
						if not is_torch_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .modeling_nllb_moe import (
						    NLLB_MOE_PRETRAINED_MODEL_ARCHIVE_LIST,
						    NllbMoeForConditionalGeneration,
						    NllbMoeModel,
						    NllbMoePreTrainedModel,
						    NllbMoeSparseMLP,
						    NllbMoeTopaRouter,
						)


else:
			import sys

			A__           =							_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)



