


'''simple docstring'''







import warnings

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


lowerCAmelCase     :  List[str]											=    logging.get_logger(__name__)

lowerCAmelCase     :  List[str]											=    {
    """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 						UpperCamelCase__       (			SCREAMING_SNAKE_CASE_						):



     """simple docstring"""






     __magic_name__           =     "xlnet"
     __magic_name__           =     ["mems"]
     __magic_name__           =     {
         "n_token": "vocab_size",  # Backward compatibility
         "hidden_size": "d_model",
         "num_attention_heads": "n_head",
         "num_hidden_layers": "n_layer",
     }







     def __init__(			self   ,						snake_case__=3_2000   ,						snake_case__=1024   ,						snake_case__=24   ,						snake_case__=16   ,						snake_case__=4096   ,						snake_case__="gelu"   ,						snake_case__=True   ,						snake_case__="bi"   ,						snake_case__=0.02   ,						snake_case__=1E-12   ,						snake_case__=0.1   ,						snake_case__=512   ,						snake_case__=None   ,						snake_case__=True   ,						snake_case__=False   ,						snake_case__=False   ,						snake_case__=-1   ,						snake_case__=False   ,						snake_case__="last"   ,						snake_case__=True   ,						snake_case__="tanh"   ,						snake_case__=0.1   ,						snake_case__=5   ,						snake_case__=5   ,						snake_case__=5   ,						snake_case__=1   ,						snake_case__=2   ,						**snake_case__   ,						):

            '''simple docstring'''

            _lowerCAmelCase     :				Optional[Any]       =							vocab_size
            _lowerCAmelCase     :				List[Any]       =							d_model
            _lowerCAmelCase     :				List[Any]       =							n_layer
            _lowerCAmelCase     :				Dict       =							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     :				Any       =							d_model // n_head
            _lowerCAmelCase     :				int       =							ff_activation
            _lowerCAmelCase     :				Tuple       =							d_inner
            _lowerCAmelCase     :				Optional[Any]       =							untie_r
            _lowerCAmelCase     :				List[Any]       =							attn_type

            _lowerCAmelCase     :				Tuple       =							initializer_range
            _lowerCAmelCase     :				Optional[Any]       =							layer_norm_eps

            _lowerCAmelCase     :				str       =							dropout
            _lowerCAmelCase     :				List[str]       =							mem_len
            _lowerCAmelCase     :				List[Any]       =							reuse_len
            _lowerCAmelCase     :				List[Any]       =							bi_data
            _lowerCAmelCase     :				List[Any]       =							clamp_len
            _lowerCAmelCase     :				Tuple       =							same_length

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

            _lowerCAmelCase     :				str       =							bos_token_id
            _lowerCAmelCase     :				Any       =							pad_token_id
            _lowerCAmelCase     :				List[str]       =							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     :				Any       =							kwargs['use_cache']

            _lowerCAmelCase     :				Tuple       =							use_mems_eval
            _lowerCAmelCase     :				List[str]       =							use_mems_train
            super().__init__(pad_token_id=snake_case__   ,						bos_token_id=snake_case__   ,						eos_token_id=snake_case__   ,						**snake_case__ )







     @property
     def a						(			self ):

            '''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 a						(			self   ,						snake_case__ ):

            '''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_tokenizers_available, is_torch_available


lowerCAmelCase     :  Any											=    {
    """configuration_canine""": ["""CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """CanineConfig"""],
    """tokenization_canine""": ["""CanineTokenizer"""],
}

try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       lowerCAmelCase     :  Tuple											=    [
           """CANINE_PRETRAINED_MODEL_ARCHIVE_LIST""",
           """CanineForMultipleChoice""",
           """CanineForQuestionAnswering""",
           """CanineForSequenceClassification""",
           """CanineForTokenClassification""",
           """CanineLayer""",
           """CanineModel""",
           """CaninePreTrainedModel""",
           """load_tf_weights_in_canine""",
       ]


if TYPE_CHECKING:
       from .configuration_canine import CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP, CanineConfig
       from .tokenization_canine import CanineTokenizer

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_canine import (
                  CANINE_PRETRAINED_MODEL_ARCHIVE_LIST,
                  CanineForMultipleChoice,
                  CanineForQuestionAnswering,
                  CanineForSequenceClassification,
                  CanineForTokenClassification,
                  CanineLayer,
                  CanineModel,
                  CaninePreTrainedModel,
                  load_tf_weights_in_canine,
              )


else:
       import sys

       lowerCAmelCase     :  Optional[Any]											=    _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)

