




import warnings

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


_UpperCAmelCase	:						int			=     logging.get_logger(__name__)

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






       def __init__(   self:					str       ,					_lowerCAmelCase:					int=3_20_00       ,					_lowerCAmelCase:					str=10_24       ,					_lowerCAmelCase:					Dict=24       ,					_lowerCAmelCase:					Tuple=16       ,					_lowerCAmelCase:					Union[str, Any]=40_96       ,					_lowerCAmelCase:					str="gelu"       ,					_lowerCAmelCase:					Union[str, Any]=True       ,					_lowerCAmelCase:					Optional[int]="bi"       ,					_lowerCAmelCase:					Dict=0.02       ,					_lowerCAmelCase:					str=1e-1_2       ,					_lowerCAmelCase:					Optional[Any]=0.1       ,					_lowerCAmelCase:					Any=5_12       ,					_lowerCAmelCase:					int=None       ,					_lowerCAmelCase:					Optional[int]=True       ,					_lowerCAmelCase:					Optional[Any]=False       ,					_lowerCAmelCase:					Optional[Any]=False       ,					_lowerCAmelCase:					List[Any]=-1       ,					_lowerCAmelCase:					str=False       ,					_lowerCAmelCase:					Tuple="last"       ,					_lowerCAmelCase:					str=True       ,					_lowerCAmelCase:					Tuple="tanh"       ,					_lowerCAmelCase:					List[str]=0.1       ,					_lowerCAmelCase:					int=5       ,					_lowerCAmelCase:					Optional[int]=5       ,					_lowerCAmelCase:					Dict=5       ,					_lowerCAmelCase:					Optional[Any]=1       ,					_lowerCAmelCase:					Tuple=2       ,					**_lowerCAmelCase:					Optional[int]       ,					):
         lowercase    :Any      	=						vocab_size
         lowercase    :List[Any]      	=						d_model
         lowercase    :str      	=						n_layer
         lowercase    :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})"				)
         lowercase    :Dict      	=						d_model // n_head
         lowercase    :List[Any]      	=						ff_activation
         lowercase    :str      	=						d_inner
         lowercase    :Dict      	=						untie_r
         lowercase    :List[str]      	=						attn_type

         lowercase    :Tuple      	=						initializer_range
         lowercase    :str      	=						layer_norm_eps

         lowercase    :List[str]      	=						dropout
         lowercase    :List[Any]      	=						mem_len
         lowercase    :Dict      	=						reuse_len
         lowercase    :List[str]      	=						bi_data
         lowercase    :Any      	=						clamp_len
         lowercase    :List[str]      	=						same_length

         lowercase    :Union[str, Any]      	=						summary_type
         lowercase    :str      	=						summary_use_proj
         lowercase    :List[str]      	=						summary_activation
         lowercase    :List[str]      	=						summary_last_dropout
         lowercase    :List[str]      	=						start_n_top
         lowercase    :Union[str, Any]      	=						end_n_top

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

         lowercase    :Any      	=						use_mems_eval
         lowercase    :Tuple      	=						use_mems_train
         super().__init__(pad_token_id=_lowerCAmelCase       ,					bos_token_id=_lowerCAmelCase       ,					eos_token_id=_lowerCAmelCase       ,					**_lowerCAmelCase				)






       @property
       def 					SCREAMING_SNAKE_CASE    (   self:					Tuple				):
         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:					Any       ,					_lowerCAmelCase:					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."				)









from typing import TYPE_CHECKING

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


_UpperCAmelCase	:						Optional[int]			=     {
    "configuration_biogpt": ["BIOGPT_PRETRAINED_CONFIG_ARCHIVE_MAP", "BioGptConfig"],
    "tokenization_biogpt": ["BioGptTokenizer"],
}

try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     _UpperCAmelCase	:						int			=     [
         "BIOGPT_PRETRAINED_MODEL_ARCHIVE_LIST",
         "BioGptForCausalLM",
         "BioGptForTokenClassification",
         "BioGptForSequenceClassification",
         "BioGptModel",
         "BioGptPreTrainedModel",
     ]


if TYPE_CHECKING:
     from .configuration_biogpt import BIOGPT_PRETRAINED_CONFIG_ARCHIVE_MAP, BioGptConfig
     from .tokenization_biogpt import BioGptTokenizer

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_biogpt import (
              BIOGPT_PRETRAINED_MODEL_ARCHIVE_LIST,
              BioGptForCausalLM,
              BioGptForSequenceClassification,
              BioGptForTokenClassification,
              BioGptModel,
              BioGptPreTrainedModel,
          )


else:
     import sys

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



