


import warnings

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


_A		:				int									=       logging.get_logger(__name__)

_A		:				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        a					(			__UpperCAmelCase   ):
       UpperCAmelCase__ :  Any						      =	"xlnet"
       UpperCAmelCase__ :  List[str]						      =	["mems"]
       UpperCAmelCase__ :  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					:				Dict    ,	SCREAMING_SNAKE_CASE_					:				Optional[int]=32000    ,	SCREAMING_SNAKE_CASE_					:				List[Any]=1024    ,	SCREAMING_SNAKE_CASE_					:				Dict=24    ,	SCREAMING_SNAKE_CASE_					:				Tuple=16    ,	SCREAMING_SNAKE_CASE_					:				Union[str, Any]=4096    ,	SCREAMING_SNAKE_CASE_					:				Optional[int]="gelu"    ,	SCREAMING_SNAKE_CASE_					:				Tuple=True    ,	SCREAMING_SNAKE_CASE_					:				Optional[Any]="bi"    ,	SCREAMING_SNAKE_CASE_					:				str=0.02    ,	SCREAMING_SNAKE_CASE_					:				List[Any]=1E-1_2    ,	SCREAMING_SNAKE_CASE_					:				Optional[int]=0.1    ,	SCREAMING_SNAKE_CASE_					:				Dict=512    ,	SCREAMING_SNAKE_CASE_					:				Any=None    ,	SCREAMING_SNAKE_CASE_					:				Optional[Any]=True    ,	SCREAMING_SNAKE_CASE_					:				Optional[int]=False    ,	SCREAMING_SNAKE_CASE_					:				Optional[int]=False    ,	SCREAMING_SNAKE_CASE_					:				Union[str, Any]=-1    ,	SCREAMING_SNAKE_CASE_					:				Tuple=False    ,	SCREAMING_SNAKE_CASE_					:				str="last"    ,	SCREAMING_SNAKE_CASE_					:				Tuple=True    ,	SCREAMING_SNAKE_CASE_					:				int="tanh"    ,	SCREAMING_SNAKE_CASE_					:				Any=0.1    ,	SCREAMING_SNAKE_CASE_					:				Union[str, Any]=5    ,	SCREAMING_SNAKE_CASE_					:				Any=5    ,	SCREAMING_SNAKE_CASE_					:				int=5    ,	SCREAMING_SNAKE_CASE_					:				str=1    ,	SCREAMING_SNAKE_CASE_					:				Optional[Any]=2    ,	**SCREAMING_SNAKE_CASE_					:				Optional[int]    ,	):
          __lowerCamelCase:				Tuple     =	vocab_size
          __lowerCamelCase:				Tuple     =	d_model
          __lowerCamelCase:				int     =	n_layer
          __lowerCamelCase:				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})'							)
          __lowerCamelCase:				str     =	d_model // n_head
          __lowerCamelCase:				str     =	ff_activation
          __lowerCamelCase:				Optional[Any]     =	d_inner
          __lowerCamelCase:				Optional[Any]     =	untie_r
          __lowerCamelCase:				Dict     =	attn_type

          __lowerCamelCase:				Tuple     =	initializer_range
          __lowerCamelCase:				Optional[int]     =	layer_norm_eps

          __lowerCamelCase:				Any     =	dropout
          __lowerCamelCase:				Tuple     =	mem_len
          __lowerCamelCase:				str     =	reuse_len
          __lowerCamelCase:				Dict     =	bi_data
          __lowerCamelCase:				Any     =	clamp_len
          __lowerCamelCase:				Union[str, Any]     =	same_length

          __lowerCamelCase:				str     =	summary_type
          __lowerCamelCase:				Dict     =	summary_use_proj
          __lowerCamelCase:				Optional[int]     =	summary_activation
          __lowerCamelCase:				Optional[Any]     =	summary_last_dropout
          __lowerCamelCase:				Any     =	start_n_top
          __lowerCamelCase:				int     =	end_n_top

          __lowerCamelCase:				Dict     =	bos_token_id
          __lowerCamelCase:				int     =	pad_token_id
          __lowerCamelCase:				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."""    ,	_lowerCamelCase    ,	)
             __lowerCamelCase:				Tuple     =	kwargs["""use_cache"""]

          __lowerCamelCase:				Optional[Any]     =	use_mems_eval
          __lowerCamelCase:				Union[str, Any]     =	use_mems_train
          super().__init__(pad_token_id=_lowerCamelCase    ,	bos_token_id=_lowerCamelCase    ,	eos_token_id=_lowerCamelCase    ,	**_lowerCamelCase							)





       @property
       def  SCREAMING_SNAKE_CASE__       (    self					:				List[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					:				str    ,	SCREAMING_SNAKE_CASE_					:				List[Any]							):
          # 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_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


_A		:				List[Any]									=       {
    '''configuration_convbert''': ['''CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ConvBertConfig''', '''ConvBertOnnxConfig'''],
    '''tokenization_convbert''': ['''ConvBertTokenizer'''],
}

try:
   if not is_tokenizers_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _A		:				int									=       ['''ConvBertTokenizerFast''']

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _A		:				List[Any]									=       [
       '''CONVBERT_PRETRAINED_MODEL_ARCHIVE_LIST''',
       '''ConvBertForMaskedLM''',
       '''ConvBertForMultipleChoice''',
       '''ConvBertForQuestionAnswering''',
       '''ConvBertForSequenceClassification''',
       '''ConvBertForTokenClassification''',
       '''ConvBertLayer''',
       '''ConvBertModel''',
       '''ConvBertPreTrainedModel''',
       '''load_tf_weights_in_convbert''',
   ]


try:
   if not is_tf_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _A		:				List[Any]									=       [
       '''TF_CONVBERT_PRETRAINED_MODEL_ARCHIVE_LIST''',
       '''TFConvBertForMaskedLM''',
       '''TFConvBertForMultipleChoice''',
       '''TFConvBertForQuestionAnswering''',
       '''TFConvBertForSequenceClassification''',
       '''TFConvBertForTokenClassification''',
       '''TFConvBertLayer''',
       '''TFConvBertModel''',
       '''TFConvBertPreTrainedModel''',
   ]


if TYPE_CHECKING:
   from .configuration_convbert import CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, ConvBertConfig, ConvBertOnnxConfig
   from .tokenization_convbert import ConvBertTokenizer

   try:
      if not is_tokenizers_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .tokenization_convbert_fast import ConvBertTokenizerFast

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_convbert import (
          CONVBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
          ConvBertForMaskedLM,
          ConvBertForMultipleChoice,
          ConvBertForQuestionAnswering,
          ConvBertForSequenceClassification,
          ConvBertForTokenClassification,
          ConvBertLayer,
          ConvBertModel,
          ConvBertPreTrainedModel,
          load_tf_weights_in_convbert,
      )

   try:
      if not is_tf_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_tf_convbert import (
          TF_CONVBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
          TFConvBertForMaskedLM,
          TFConvBertForMultipleChoice,
          TFConvBertForQuestionAnswering,
          TFConvBertForSequenceClassification,
          TFConvBertForTokenClassification,
          TFConvBertLayer,
          TFConvBertModel,
          TFConvBertPreTrainedModel,
      )


else:
   import sys

   _A		:				int									=       _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)


