




'''simple docstring'''







from collections import OrderedDict
from typing import Mapping

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


_lowerCamelCase							:						Tuple								=  logging.get_logger(__name__)

_lowerCamelCase							:						Dict								=  {
    'mnaylor/mega-base-wikitext': 'https://huggingface.co/mnaylor/mega-base-wikitext/resolve/main/config.json',
}





class      lowerCamelCase_							(       UpperCAmelCase_							):




					'''simple docstring'''






					lowercase__    = """mega"""






					def __init__(    self,  __UpperCamelCase=30_522,  __UpperCamelCase=128,  __UpperCamelCase=4,  __UpperCamelCase=256,  __UpperCamelCase=16,  __UpperCamelCase=True,  __UpperCamelCase=64,  __UpperCamelCase=False,  __UpperCamelCase=-1,  __UpperCamelCase=None,  __UpperCamelCase=True,  __UpperCamelCase="scalenorm",  __UpperCamelCase=True,  __UpperCamelCase="silu",  __UpperCamelCase="softmax",  __UpperCamelCase=0.1,  __UpperCamelCase=0.1,  __UpperCamelCase=0.1,  __UpperCamelCase=False,  __UpperCamelCase=True,  __UpperCamelCase=256,  __UpperCamelCase=True,  __UpperCamelCase=0.1,  __UpperCamelCase=2_048,  __UpperCamelCase=False,  __UpperCamelCase=2,  __UpperCamelCase=0.02,  __UpperCamelCase=0.2,  __UpperCamelCase=0.02,  __UpperCamelCase=1.0,  __UpperCamelCase=1,  __UpperCamelCase=0,  __UpperCamelCase=2,  __UpperCamelCase="rotary",  __UpperCamelCase=None,  __UpperCamelCase=True,  __UpperCamelCase=True,  **__UpperCamelCase,  ):
							super().__init__(pad_token_id=__UpperCamelCase,  bos_token_id=__UpperCamelCase,  eos_token_id=__UpperCamelCase,  **__UpperCamelCase )

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





class      lowerCamelCase_							(       UpperCAmelCase_							):




					'''simple docstring'''






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








'''simple docstring'''
import os
import unittest

import pytest
from parameterized import parameterized

from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device


# skipping in unittest tests

_lowerCamelCase	 =			[(1,)]


def       a__    (  )			-> str:


	"""simple docstring"""





	UpperCAmelCase_			:	Optional[int]      =   bool(os.getenv("RUN_SLOW"     ,							0							)							)
	if run_slow:
		assert True
	else:
		assert False, "should have been skipped"


def       a__    (  )			-> str:


	"""simple docstring"""





	UpperCAmelCase_			:	Optional[Any]      =   bool(os.getenv("RUN_SLOW"     ,							0							)							)
	if run_slow and torch_device == "cuda":
		assert True
	else:
		assert False, "should have been skipped"
@require_torch
class  _snake_case						(unittest.TestCase):






			@slow
			@require_torch_gpu
			def 						UpperCamelCase__				(   self			):
				check_slow_torch_cuda()






			@require_torch_gpu
			@slow
			def 						UpperCamelCase__				(   self			):
				check_slow_torch_cuda()






			@parameterized.expand(_snake_case			)
			@slow
			def 						UpperCamelCase__				(   self       ,_snake_case=None			):
				check_slow()




@slow
@require_torch_gpu
def       a__    (  )			-> List[Any]:


	"""simple docstring"""





	check_slow_torch_cuda()


@require_torch_gpu
@slow
def       a__    (  )			-> List[str]:


	"""simple docstring"""





	check_slow_torch_cuda()


@slow
@pytest.mark.parametrize("param"     ,							[1]							)
def       a__    (  _SCREAMING_SNAKE_CASE					:    int							)			-> List[Any]:


	"""simple docstring"""





	check_slow()





@pytest.mark.parametrize("param"     ,							[1]							)
@slow
def       a__    (  _SCREAMING_SNAKE_CASE					:    List[str]							)			-> Any:


	"""simple docstring"""





	check_slow()




