




'''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 		lowercase_   (			__snake_case       ):


   """simple docstring"""

   lowerCamelCase_      =						"""xlnet"""
   lowerCamelCase_      =						["""mems"""]
   lowerCamelCase_      =						{
       """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]  ,				__lowerCamelCase :     Any=3_2_0_0_0  ,				__lowerCamelCase :     Any=1_0_2_4  ,				__lowerCamelCase :     Any=2_4  ,				__lowerCamelCase :     Tuple=1_6  ,				__lowerCamelCase :     List[str]=4_0_9_6  ,				__lowerCamelCase :     Optional[Any]="gelu"  ,				__lowerCamelCase :     List[Any]=True  ,				__lowerCamelCase :     Optional[int]="bi"  ,				__lowerCamelCase :     Any=0.0_2  ,				__lowerCamelCase :     Optional[Any]=1e-12  ,				__lowerCamelCase :     Optional[int]=0.1  ,				__lowerCamelCase :     Optional[Any]=5_1_2  ,				__lowerCamelCase :     int=None  ,				__lowerCamelCase :     str=True  ,				__lowerCamelCase :     Union[str, Any]=False  ,				__lowerCamelCase :     Any=False  ,				__lowerCamelCase :     Any=-1  ,				__lowerCamelCase :     int=False  ,				__lowerCamelCase :     int="last"  ,				__lowerCamelCase :     Tuple=True  ,				__lowerCamelCase :     Dict="tanh"  ,				__lowerCamelCase :     Optional[int]=0.1  ,				__lowerCamelCase :     List[Any]=5  ,				__lowerCamelCase :     int=5  ,				__lowerCamelCase :     str=5  ,				__lowerCamelCase :     Union[str, Any]=1  ,				__lowerCamelCase :     Optional[Any]=2  ,				**__lowerCamelCase :     Union[str, Any]  ,				):

      """simple docstring"""
      _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 							lowerCAmelCase_      (   self :     List[str]   ):

      """simple docstring"""
      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 							lowerCAmelCase_      (   self :     int  ,				__lowerCamelCase :     int   ):

      """simple docstring"""
      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_ctrl': ['CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CTRLConfig'],
    'tokenization_ctrl': ['CTRLTokenizer'],
}

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCamelCase_			=						[
     'CTRL_PRETRAINED_MODEL_ARCHIVE_LIST',
     'CTRLForSequenceClassification',
     'CTRLLMHeadModel',
     'CTRLModel',
     'CTRLPreTrainedModel',
 ]

try:
 if not is_tf_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCamelCase_			=						[
     'TF_CTRL_PRETRAINED_MODEL_ARCHIVE_LIST',
     'TFCTRLForSequenceClassification',
     'TFCTRLLMHeadModel',
     'TFCTRLModel',
     'TFCTRLPreTrainedModel',
 ]


if TYPE_CHECKING:
 from .configuration_ctrl import CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP, CTRLConfig
 from .tokenization_ctrl import CTRLTokenizer

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_ctrl import (
      CTRL_PRETRAINED_MODEL_ARCHIVE_LIST,
      CTRLForSequenceClassification,
      CTRLLMHeadModel,
      CTRLModel,
      CTRLPreTrainedModel,
  )

 try:
  if not is_tf_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_tf_ctrl import (
      TF_CTRL_PRETRAINED_MODEL_ARCHIVE_LIST,
      TFCTRLForSequenceClassification,
      TFCTRLLMHeadModel,
      TFCTRLModel,
      TFCTRLPreTrainedModel,
  )

else:
 import sys

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

