
import warnings

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


lowercase__		:List[Any]			  =   logging.get_logger(__name__)

lowercase__		:List[Any]			  =   {
    "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		( SCREAMING_SNAKE_CASE__		):
							lowercase_	:	List[Any]	 ='''xlnet'''
							lowercase_	:	int	 =['''mems''']
							lowercase_	:	Any	 ={
							    '''n_token''': '''vocab_size''',  # Backward compatibility
							    '''hidden_size''': '''d_model''',
							    '''num_attention_heads''': '''n_head''',
							    '''num_hidden_layers''': '''n_layer''',
							}




							def __init__(    self       ,A__=3_2_0_0_0       ,A__=1_0_2_4       ,A__=2_4       ,A__=1_6       ,A__=4_0_9_6       ,A__="gelu"       ,A__=True       ,A__="bi"       ,A__=0.02       ,A__=1E-12       ,A__=0.1       ,A__=5_1_2       ,A__=None       ,A__=True       ,A__=False       ,A__=False       ,A__=-1       ,A__=False       ,A__="last"       ,A__=True       ,A__="tanh"       ,A__=0.1       ,A__=5       ,A__=5       ,A__=5       ,A__=1       ,A__=2       ,**A__       ,):
												lowercase						     =						vocab_size
												lowercase						     =						d_model
												lowercase						     =						n_layer
												lowercase						     =						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						     =						d_model // n_head
												lowercase						     =						ff_activation
												lowercase						     =						d_inner
												lowercase						     =						untie_r
												lowercase						     =						attn_type

												lowercase						     =						initializer_range
												lowercase						     =						layer_norm_eps

												lowercase						     =						dropout
												lowercase						     =						mem_len
												lowercase						     =						reuse_len
												lowercase						     =						bi_data
												lowercase						     =						clamp_len
												lowercase						     =						same_length

												lowercase						     =						summary_type
												lowercase						     =						summary_use_proj
												lowercase						     =						summary_activation
												lowercase						     =						summary_last_dropout
												lowercase						     =						start_n_top
												lowercase						     =						end_n_top

												lowercase						     =						bos_token_id
												lowercase						     =						pad_token_id
												lowercase						     =						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.'''       ,A__       ,)
																	lowercase						     =						kwargs['''use_cache''']

												lowercase						     =						use_mems_eval
												lowercase						     =						use_mems_train
												super().__init__(pad_token_id=A__       ,bos_token_id=A__       ,eos_token_id=A__       ,**A__)




							@property
							def 			A__				(    self):
												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 			A__				(    self       ,A__):
												# 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


lowercase__		:Dict			  =   {
    "configuration_luke": ["LUKE_PRETRAINED_CONFIG_ARCHIVE_MAP", "LukeConfig"],
    "tokenization_luke": ["LukeTokenizer"],
}

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							lowercase__		:List[str]			  =   [
							    "LUKE_PRETRAINED_MODEL_ARCHIVE_LIST",
							    "LukeForEntityClassification",
							    "LukeForEntityPairClassification",
							    "LukeForEntitySpanClassification",
							    "LukeForMultipleChoice",
							    "LukeForQuestionAnswering",
							    "LukeForSequenceClassification",
							    "LukeForTokenClassification",
							    "LukeForMaskedLM",
							    "LukeModel",
							    "LukePreTrainedModel",
							]


if TYPE_CHECKING:
							from .configuration_luke import LUKE_PRETRAINED_CONFIG_ARCHIVE_MAP, LukeConfig
							from .tokenization_luke import LukeTokenizer

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_luke import (
														    LUKE_PRETRAINED_MODEL_ARCHIVE_LIST,
														    LukeForEntityClassification,
														    LukeForEntityPairClassification,
														    LukeForEntitySpanClassification,
														    LukeForMaskedLM,
														    LukeForMultipleChoice,
														    LukeForQuestionAnswering,
														    LukeForSequenceClassification,
														    LukeForTokenClassification,
														    LukeModel,
														    LukePreTrainedModel,
														)

else:
							import sys

							lowercase__		:Tuple			  =   _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)




