



'''simple docstring'''

import warnings

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


__lowerCAmelCase						      =       logging.get_logger(__name__)

__lowerCAmelCase						      =       {
    '''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      __magic_name__						(   _UpperCamelCase       ):
							lowerCAmelCase	:   Optional[Any]           = 'xlnet'
							lowerCAmelCase	:   int           = ['mems']
							lowerCAmelCase	:   Optional[int]           = {
							    'n_token': 'vocab_size',  # Backward compatibility
							    'hidden_size': 'd_model',
							    'num_attention_heads': 'n_head',
							    'num_hidden_layers': 'n_layer',
							}







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

									_a					:				Tuple				=							initializer_range
									_a					:				Tuple				=							layer_norm_eps

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

									_a					:				int				=							summary_type
									_a					:				Any				=							summary_use_proj
									_a					:				Dict				=							summary_activation
									_a					:				Tuple				=							summary_last_dropout
									_a					:				Any				=							start_n_top
									_a					:				Optional[Any]				=							end_n_top

									_a					:				List[str]				=							bos_token_id
									_a					:				Dict				=							pad_token_id
									_a					:				List[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.'     ,_UpperCAmelCase     ,)
											_a					:				List[Any]				=							kwargs['use_cache']

									_a					:				Optional[Any]				=							use_mems_eval
									_a					:				List[Any]				=							use_mems_train
									super().__init__(pad_token_id=_UpperCAmelCase     ,bos_token_id=_UpperCAmelCase     ,eos_token_id=_UpperCAmelCase     ,**_UpperCAmelCase		)







							@property
							def 							__lowercase      (							self :	Optional[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 							__lowercase      (							self :	List[str]     ,_UpperCAmelCase :	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'''

from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available


__lowerCAmelCase						      =       {
    '''configuration_data2vec_audio''': ['''DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Data2VecAudioConfig'''],
    '''configuration_data2vec_text''': [
        '''DATA2VEC_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''Data2VecTextConfig''',
        '''Data2VecTextOnnxConfig''',
    ],
    '''configuration_data2vec_vision''': [
        '''DATA2VEC_VISION_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''Data2VecVisionConfig''',
        '''Data2VecVisionOnnxConfig''',
    ],
}

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__lowerCAmelCase						      =       [
							    '''DATA2VEC_AUDIO_PRETRAINED_MODEL_ARCHIVE_LIST''',
							    '''Data2VecAudioForAudioFrameClassification''',
							    '''Data2VecAudioForCTC''',
							    '''Data2VecAudioForSequenceClassification''',
							    '''Data2VecAudioForXVector''',
							    '''Data2VecAudioModel''',
							    '''Data2VecAudioPreTrainedModel''',
							]
							__lowerCAmelCase						      =       [
							    '''DATA2VEC_TEXT_PRETRAINED_MODEL_ARCHIVE_LIST''',
							    '''Data2VecTextForCausalLM''',
							    '''Data2VecTextForMaskedLM''',
							    '''Data2VecTextForMultipleChoice''',
							    '''Data2VecTextForQuestionAnswering''',
							    '''Data2VecTextForSequenceClassification''',
							    '''Data2VecTextForTokenClassification''',
							    '''Data2VecTextModel''',
							    '''Data2VecTextPreTrainedModel''',
							]
							__lowerCAmelCase						      =       [
							    '''DATA2VEC_VISION_PRETRAINED_MODEL_ARCHIVE_LIST''',
							    '''Data2VecVisionForImageClassification''',
							    '''Data2VecVisionForMaskedImageModeling''',
							    '''Data2VecVisionForSemanticSegmentation''',
							    '''Data2VecVisionModel''',
							    '''Data2VecVisionPreTrainedModel''',
							]

if is_tf_available():
							__lowerCAmelCase						      =       [
							    '''TFData2VecVisionForImageClassification''',
							    '''TFData2VecVisionForSemanticSegmentation''',
							    '''TFData2VecVisionModel''',
							    '''TFData2VecVisionPreTrainedModel''',
							]

if TYPE_CHECKING:
							from .configuration_dataavec_audio import DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP, DataaVecAudioConfig
							from .configuration_dataavec_text import (
							    DATA2VEC_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP,
							    DataaVecTextConfig,
							    DataaVecTextOnnxConfig,
							)
							from .configuration_dataavec_vision import (
							    DATA2VEC_VISION_PRETRAINED_CONFIG_ARCHIVE_MAP,
							    DataaVecVisionConfig,
							    DataaVecVisionOnnxConfig,
							)

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_dataavec_audio import (
														    DATA2VEC_AUDIO_PRETRAINED_MODEL_ARCHIVE_LIST,
														    DataaVecAudioForAudioFrameClassification,
														    DataaVecAudioForCTC,
														    DataaVecAudioForSequenceClassification,
														    DataaVecAudioForXVector,
														    DataaVecAudioModel,
														    DataaVecAudioPreTrainedModel,
														)
														from .modeling_dataavec_text import (
														    DATA2VEC_TEXT_PRETRAINED_MODEL_ARCHIVE_LIST,
														    DataaVecTextForCausalLM,
														    DataaVecTextForMaskedLM,
														    DataaVecTextForMultipleChoice,
														    DataaVecTextForQuestionAnswering,
														    DataaVecTextForSequenceClassification,
														    DataaVecTextForTokenClassification,
														    DataaVecTextModel,
														    DataaVecTextPreTrainedModel,
														)
														from .modeling_dataavec_vision import (
														    DATA2VEC_VISION_PRETRAINED_MODEL_ARCHIVE_LIST,
														    DataaVecVisionForImageClassification,
														    DataaVecVisionForMaskedImageModeling,
														    DataaVecVisionForSemanticSegmentation,
														    DataaVecVisionModel,
														    DataaVecVisionPreTrainedModel,
														)
							if is_tf_available():
														from .modeling_tf_dataavec_vision import (
														    TFDataaVecVisionForImageClassification,
														    TFDataaVecVisionForSemanticSegmentation,
														    TFDataaVecVisionModel,
														    TFDataaVecVisionPreTrainedModel,
														)

else:
							import sys

							__lowerCAmelCase						      =       _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)




