


'''simple docstring'''







from collections import OrderedDict
from typing import Mapping

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


a__  : Union[str, Any]				=	logging.get_logger(__name__)

a__  : Dict				=	{
    '''mnaylor/mega-base-wikitext''': '''https://huggingface.co/mnaylor/mega-base-wikitext/resolve/main/config.json''',
}
class  lowercase_					(   A__       ):
    __UpperCAmelCase             =     'mega'


    def __init__(					self  , a=3_05_22  , a=1_28  , a=4  , a=2_56  , a=16  , a=True  , a=64  , a=False  , a=-1  , a=None  , a=True  , a="scalenorm"  , a=True  , a="silu"  , a="softmax"  , a=0.1  , a=0.1  , a=0.1  , a=False  , a=True  , a=2_56  , a=True  , a=0.1  , a=20_48  , a=False  , a=2  , a=0.02  , a=0.2  , a=0.02  , a=1.0  , a=1  , a=0  , a=2  , a="rotary"  , a=None  , a=True  , a=True  , **a  , ):
          super().__init__(pad_token_id=_A  , bos_token_id=_A  , eos_token_id=_A  , **_A   )

          UpperCamelCase__  =    vocab_size
          UpperCamelCase__  =    hidden_size
          UpperCamelCase__  =    num_hidden_layers
          UpperCamelCase__  =    activation
          UpperCamelCase__  =    attention_activation
          UpperCamelCase__  =    intermediate_size
          UpperCamelCase__  =    ema_projection_size
          UpperCamelCase__  =    bidirectional
          UpperCamelCase__  =    shared_representation_size
          UpperCamelCase__  =    use_chunking
          UpperCamelCase__  =    chunk_size
          UpperCamelCase__  =    truncation
          UpperCamelCase__  =    normalize_before_mega
          UpperCamelCase__  =    normalization_type
          UpperCamelCase__  =    norm_affine
          UpperCamelCase__  =    dropout_prob
          UpperCamelCase__  =    hidden_dropout_prob
          UpperCamelCase__  =    attention_probs_dropout_prob
          UpperCamelCase__  =    use_feature_dropout
          UpperCamelCase__  =    use_normalized_ffn
          UpperCamelCase__  =    nffn_hidden_size
          UpperCamelCase__  =    normalize_before_ffn
          UpperCamelCase__  =    nffn_activation_dropout_prob
          UpperCamelCase__  =    max_positions
          UpperCamelCase__  =    add_token_type_embeddings
          UpperCamelCase__  =    type_vocab_size
          UpperCamelCase__  =    initializer_range
          UpperCamelCase__  =    ema_delta_alpha_range
          UpperCamelCase__  =    ema_beta_range
          UpperCamelCase__  =    ema_gamma_omega_range
          UpperCamelCase__  =    relative_positional_bias
          UpperCamelCase__  =    use_cache
          UpperCamelCase__  =    classifier_dropout
          UpperCamelCase__  =    add_lm_hidden_dense_layer
          UpperCamelCase__  =    1  # not used but required by Hugging Face

class  lowercase_					(   A__       ):


    @property
    def        __a							(					self   ):






          if self.task == "multiple-choice":
                UpperCamelCase__  =    {0: "batch", 1: "choice", 2: "sequence"}
          else:
                UpperCamelCase__  =    {0: "batch", 1: "sequence"}
          return OrderedDict(
              [
                  ("input_ids", dynamic_axis),
                  ("attention_mask", dynamic_axis),
              ]   )










'''simple docstring'''







from typing import TYPE_CHECKING

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


a__  : Any				=	{
    'configuration_codegen': ['CODEGEN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CodeGenConfig', 'CodeGenOnnxConfig'],
    'tokenization_codegen': ['CodeGenTokenizer'],
}

try:
  if not is_tokenizers_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  a__  : Tuple				=	['CodeGenTokenizerFast']

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  a__  : Dict				=	[
      'CODEGEN_PRETRAINED_MODEL_ARCHIVE_LIST',
      'CodeGenForCausalLM',
      'CodeGenModel',
      'CodeGenPreTrainedModel',
  ]

if TYPE_CHECKING:
  from .configuration_codegen import CODEGEN_PRETRAINED_CONFIG_ARCHIVE_MAP, CodeGenConfig, CodeGenOnnxConfig
  from .tokenization_codegen import CodeGenTokenizer

  try:
    if not is_tokenizers_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .tokenization_codegen_fast import CodeGenTokenizerFast

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_codegen import (
        CODEGEN_PRETRAINED_MODEL_ARCHIVE_LIST,
        CodeGenForCausalLM,
        CodeGenModel,
        CodeGenPreTrainedModel,
    )

else:
  import sys

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





