






from collections import OrderedDict
from typing import Mapping

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


a    =       logging.get_logger(__name__)

a    =       {
    'mnaylor/mega-base-wikitext': 'https://huggingface.co/mnaylor/mega-base-wikitext/resolve/main/config.json',
}
class        __snake_case(					__UpperCamelCase      ):
 lowercase :       str		      =		'''mega'''



 def __init__(	self   :   List[str] ,		UpperCAmelCase__   :   Any=30_522 ,		UpperCAmelCase__   :   str=128 ,		UpperCAmelCase__   :   Optional[int]=4 ,		UpperCAmelCase__   :   Optional[Any]=256 ,		UpperCAmelCase__   :   Dict=16 ,		UpperCAmelCase__   :   Optional[int]=True ,		UpperCAmelCase__   :   int=64 ,		UpperCAmelCase__   :   List[Any]=False ,		UpperCAmelCase__   :   Tuple=-1 ,		UpperCAmelCase__   :   str=None ,		UpperCAmelCase__   :   str=True ,		UpperCAmelCase__   :   Tuple="scalenorm" ,		UpperCAmelCase__   :   Any=True ,		UpperCAmelCase__   :   Optional[int]="silu" ,		UpperCAmelCase__   :   Optional[int]="softmax" ,		UpperCAmelCase__   :   Optional[int]=0.1 ,		UpperCAmelCase__   :   Union[str, Any]=0.1 ,		UpperCAmelCase__   :   Any=0.1 ,		UpperCAmelCase__   :   Tuple=False ,		UpperCAmelCase__   :   List[str]=True ,		UpperCAmelCase__   :   Dict=256 ,		UpperCAmelCase__   :   Tuple=True ,		UpperCAmelCase__   :   Any=0.1 ,		UpperCAmelCase__   :   Optional[Any]=2_048 ,		UpperCAmelCase__   :   List[Any]=False ,		UpperCAmelCase__   :   Optional[Any]=2 ,		UpperCAmelCase__   :   Union[str, Any]=0.02 ,		UpperCAmelCase__   :   int=0.2 ,		UpperCAmelCase__   :   Any=0.02 ,		UpperCAmelCase__   :   Dict=1.0 ,		UpperCAmelCase__   :   int=1 ,		UpperCAmelCase__   :   Tuple=0 ,		UpperCAmelCase__   :   Any=2 ,		UpperCAmelCase__   :   Optional[int]="rotary" ,		UpperCAmelCase__   :   List[str]=None ,		UpperCAmelCase__   :   str=True ,		UpperCAmelCase__   :   Optional[int]=True ,		**UpperCAmelCase__   :   Optional[Any] ,		):

    """simple docstring"""






    super().__init__(pad_token_id=UpperCAmelCase__ ,		bos_token_id=UpperCAmelCase__ ,		eos_token_id=UpperCAmelCase__ ,		**UpperCAmelCase__	)

    lowercase__						:	str         = vocab_size
    lowercase__						:	Dict         = hidden_size
    lowercase__						:	str         = num_hidden_layers
    lowercase__						:	Any         = activation
    lowercase__						:	int         = attention_activation
    lowercase__						:	Any         = intermediate_size
    lowercase__						:	Dict         = ema_projection_size
    lowercase__						:	int         = bidirectional
    lowercase__						:	Union[str, Any]         = shared_representation_size
    lowercase__						:	Dict         = use_chunking
    lowercase__						:	Tuple         = chunk_size
    lowercase__						:	Any         = truncation
    lowercase__						:	Dict         = normalize_before_mega
    lowercase__						:	Optional[int]         = normalization_type
    lowercase__						:	Dict         = norm_affine
    lowercase__						:	Any         = dropout_prob
    lowercase__						:	str         = hidden_dropout_prob
    lowercase__						:	Tuple         = attention_probs_dropout_prob
    lowercase__						:	Optional[int]         = use_feature_dropout
    lowercase__						:	List[str]         = use_normalized_ffn
    lowercase__						:	Union[str, Any]         = nffn_hidden_size
    lowercase__						:	Optional[Any]         = normalize_before_ffn
    lowercase__						:	Tuple         = nffn_activation_dropout_prob
    lowercase__						:	Union[str, Any]         = max_positions
    lowercase__						:	Tuple         = add_token_type_embeddings
    lowercase__						:	Union[str, Any]         = type_vocab_size
    lowercase__						:	Any         = initializer_range
    lowercase__						:	List[str]         = ema_delta_alpha_range
    lowercase__						:	Dict         = ema_beta_range
    lowercase__						:	Tuple         = ema_gamma_omega_range
    lowercase__						:	List[Any]         = relative_positional_bias
    lowercase__						:	int         = use_cache
    lowercase__						:	Any         = classifier_dropout
    lowercase__						:	Any         = add_lm_hidden_dense_layer
    lowercase__						:	Optional[Any]         = 1  # not used but required by Hugging Face
class        __snake_case(					__UpperCamelCase      ):



 @property
 def 						UpperCAmelCase    (	self   :   str	):

    """simple docstring"""






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










from __future__ import annotations

from collections.abc import Iterator
from typing import Any
class        __snake_case:



 def __init__(	self   :   Union[str, Any] ,		UpperCAmelCase__   :   Any	):

    """simple docstring"""






    lowercase__						:	Any         = data
    lowercase__						:	Node | None         = None







 def __str__(	self   :   Dict	):

    """simple docstring"""






    return f'''{self.data}'''
class        __snake_case:



 def __init__(	self   :   Optional[Any]	):

    """simple docstring"""






    lowercase__						:	Node | None         = None
    lowercase__						:	Node | None         = None



 def __iter__(	self   :   Any	):

    """simple docstring"""






    lowercase__						:	Any         = self.front
    while node:
       yield node.data
       lowercase__						:	List[str]         = node.next



 def __len__(	self   :   Union[str, Any]	):

    """simple docstring"""






    return len(tuple(iter(self	)	)	)



 def __str__(	self   :   Optional[Any]	):

    """simple docstring"""






    return " <- ".join(str(UpperCAmelCase__	) for item in self	)



 def 						UpperCAmelCase    (	self   :   List[str]	):

    """simple docstring"""






    return len(self	) == 0



 def 						UpperCAmelCase    (	self   :   Optional[int] ,		UpperCAmelCase__   :   Any	):

    """simple docstring"""






    lowercase__						:	List[str]         = Node(UpperCAmelCase__	)
    if self.is_empty():
       lowercase__						:	List[Any]         = node
    else:
       assert isinstance(self.rear ,		UpperCAmelCase__	)
       lowercase__						:	Any         = node
       lowercase__						:	Union[str, Any]         = node



 def 						UpperCAmelCase    (	self   :   List[Any]	):

    """simple docstring"""






    if self.is_empty():
       raise IndexError("""dequeue from empty queue"""	)
    assert isinstance(self.front ,		UpperCAmelCase__	)
    lowercase__						:	Tuple         = self.front
    lowercase__						:	Any         = self.front.next
    if self.front is None:
       lowercase__						:	List[Any]         = None
    return node.data







 def 						UpperCAmelCase    (	self   :   Optional[Any]	):

    """simple docstring"""






    lowercase__						:	List[Any]         = None


if __name__ == "__main__":
 from doctest import testmod

 testmod()


