


import warnings

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


lowercase__				     =		logging.get_logger(__name__)

lowercase__				     =		{
    '''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 						__SCREAMING_SNAKE_CASE					(      a__ ):
     UpperCAmelCase 					=				"""xlnet"""
     UpperCAmelCase 					=				["""mems"""]
     UpperCAmelCase 					=				{
         """n_token""": """vocab_size""",  # Backward compatibility
         """hidden_size""": """d_model""",
         """num_attention_heads""": """n_head""",
         """num_hidden_layers""": """n_layer""",
     }






     def __init__(			self     ,							__UpperCamelCase=32_000     ,							__UpperCamelCase=1_024     ,							__UpperCamelCase=24     ,							__UpperCamelCase=16     ,							__UpperCamelCase=4_096     ,							__UpperCamelCase="gelu"     ,							__UpperCamelCase=True     ,							__UpperCamelCase="bi"     ,							__UpperCamelCase=0.02     ,							__UpperCamelCase=1e-12     ,							__UpperCamelCase=0.1     ,							__UpperCamelCase=512     ,							__UpperCamelCase=None     ,							__UpperCamelCase=True     ,							__UpperCamelCase=False     ,							__UpperCamelCase=False     ,							__UpperCamelCase=-1     ,							__UpperCamelCase=False     ,							__UpperCamelCase="last"     ,							__UpperCamelCase=True     ,							__UpperCamelCase="tanh"     ,							__UpperCamelCase=0.1     ,							__UpperCamelCase=5     ,							__UpperCamelCase=5     ,							__UpperCamelCase=5     ,							__UpperCamelCase=1     ,							__UpperCamelCase=2     ,							**__UpperCamelCase     ,							)       ->    Optional[int]:
          _a						=		vocab_size
          _a						=		d_model
          _a						=		n_layer
          _a						=		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						=		d_model // n_head
          _a						=		ff_activation
          _a						=		d_inner
          _a						=		untie_r
          _a						=		attn_type

          _a						=		initializer_range
          _a						=		layer_norm_eps

          _a						=		dropout
          _a						=		mem_len
          _a						=		reuse_len
          _a						=		bi_data
          _a						=		clamp_len
          _a						=		same_length

          _a						=		summary_type
          _a						=		summary_use_proj
          _a						=		summary_activation
          _a						=		summary_last_dropout
          _a						=		start_n_top
          _a						=		end_n_top

          _a						=		bos_token_id
          _a						=		pad_token_id
          _a						=		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__     ,							)
               _a						=		kwargs["use_cache"]

          _a						=		use_mems_eval
          _a						=		use_mems_train
          super().__init__(pad_token_id=lowerCAmelCase__     ,							bos_token_id=lowerCAmelCase__     ,							eos_token_id=lowerCAmelCase__     ,							**lowerCAmelCase__		)






     @property
     def  a_					(			self		)       ->    Union[str, 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  a_					(			self     ,							__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 collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


lowercase__				     =		logging.get_logger(__name__)

lowercase__				     =		{
    "YituTech/conv-bert-base": "https://huggingface.co/YituTech/conv-bert-base/resolve/main/config.json",
    "YituTech/conv-bert-medium-small": (
        "https://huggingface.co/YituTech/conv-bert-medium-small/resolve/main/config.json"
    ),
    "YituTech/conv-bert-small": "https://huggingface.co/YituTech/conv-bert-small/resolve/main/config.json",
    # See all ConvBERT models at https://huggingface.co/models?filter=convbert
}





class 						__SCREAMING_SNAKE_CASE					(      lowerCamelCase__ ):
     UpperCAmelCase 					=				'''convbert'''






     def __init__(			self     ,							__UpperCamelCase=30_522     ,							__UpperCamelCase=768     ,							__UpperCamelCase=12     ,							__UpperCamelCase=12     ,							__UpperCamelCase=3_072     ,							__UpperCamelCase="gelu"     ,							__UpperCamelCase=0.1     ,							__UpperCamelCase=0.1     ,							__UpperCamelCase=512     ,							__UpperCamelCase=2     ,							__UpperCamelCase=0.02     ,							__UpperCamelCase=1e-12     ,							__UpperCamelCase=1     ,							__UpperCamelCase=0     ,							__UpperCamelCase=2     ,							__UpperCamelCase=768     ,							__UpperCamelCase=2     ,							__UpperCamelCase=9     ,							__UpperCamelCase=1     ,							__UpperCamelCase=None     ,							**__UpperCamelCase     ,							)       ->    Optional[int]:
          super().__init__(
              pad_token_id=__UpperCamelCase     ,							bos_token_id=__UpperCamelCase     ,							eos_token_id=__UpperCamelCase     ,							**__UpperCamelCase     ,							)

          _a						=		vocab_size
          _a						=		hidden_size
          _a						=		num_hidden_layers
          _a						=		num_attention_heads
          _a						=		intermediate_size
          _a						=		hidden_act
          _a						=		hidden_dropout_prob
          _a						=		attention_probs_dropout_prob
          _a						=		max_position_embeddings
          _a						=		type_vocab_size
          _a						=		initializer_range
          _a						=		layer_norm_eps
          _a						=		embedding_size
          _a						=		head_ratio
          _a						=		conv_kernel_size
          _a						=		num_groups
          _a						=		classifier_dropout







class 						__SCREAMING_SNAKE_CASE					(      lowerCamelCase__ ):






     @property
     def  a_					(			self		)       ->    Mapping[str, Mapping[int, str]]:
          if self.task == "multiple-choice":
               _a						=		{0: "batch", 1: "choice", 2: "sequence"}
          else:
               _a						=		{0: "batch", 1: "sequence"}
          return OrderedDict(
              [
                  ("input_ids", dynamic_axis),
                  ("attention_mask", dynamic_axis),
                  ("token_type_ids", dynamic_axis),
              ]		)

