



from __future__ import annotations


def     UpperCamelCase(						__UpperCamelCase							:	int  ,__UpperCamelCase							:	int  ,__UpperCamelCase							:	int				):
		assert (
		    c % greatest_common_divisor(__UpperCamelCase  ,__UpperCamelCase				) == 0
		)  # greatest_common_divisor(a,b) function implemented below
		((lowerCAmelCase_)      ,						(lowerCAmelCase_)      ,						(lowerCAmelCase_))    :  Optional[Any]             =				extended_gcd(__UpperCamelCase  ,__UpperCamelCase				)  # extended_gcd(a,b) function implemented below
		lowerCAmelCase_    :  Optional[Any]             =				c / d
		return (r * x, r * y)


def     UpperCamelCase(						__UpperCamelCase							:	int  ,__UpperCamelCase							:	int  ,__UpperCamelCase							:	int  ,__UpperCamelCase							:	int = 2				):
		((lowerCAmelCase_)      ,						(lowerCAmelCase_))    :  Optional[int]             =				diophantine(__UpperCamelCase  ,__UpperCamelCase  ,__UpperCamelCase				)  # Initial value
		lowerCAmelCase_    :  Any             =				greatest_common_divisor(__UpperCamelCase  ,__UpperCamelCase				)
		lowerCAmelCase_    :  Optional[int]             =				a // d
		lowerCAmelCase_    :  Optional[int]             =				b // d

		for i in range(__UpperCamelCase				):
				lowerCAmelCase_    :  Dict             =				xa + i * q
				lowerCAmelCase_    :  Optional[int]             =				ya - i * p
				print(__UpperCamelCase  ,__UpperCamelCase				)


def     UpperCamelCase(						__UpperCamelCase							:	int  ,__UpperCamelCase							:	int				):
		if a < b:
				lowerCAmelCase_      ,						lowerCAmelCase_    :  Optional[Any]             =				b, a

		while a % b != 0:
				lowerCAmelCase_      ,						lowerCAmelCase_    :  Union[str, Any]             =				b, a % b

		return b


def     UpperCamelCase(						__UpperCamelCase							:	int  ,__UpperCamelCase							:	int				):
		assert a >= 0 and b >= 0

		if b == 0:
				lowerCAmelCase_      ,						lowerCAmelCase_      ,						lowerCAmelCase_    :  Tuple             =				a, 1, 0
		else:
				((lowerCAmelCase_)      ,						(lowerCAmelCase_)      ,						(lowerCAmelCase_))    :  List[str]             =				extended_gcd(__UpperCamelCase  ,a % b				)
				lowerCAmelCase_    :  List[str]             =				q
				lowerCAmelCase_    :  List[Any]             =				p - q * (a // b)

		assert a % d == 0 and b % d == 0
		assert d == a * x + b * y

		return (d, x, y)


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

						testmod(name='''diophantine''', verbose=True)
						testmod(name='''diophantine_all_soln''', verbose=True)
						testmod(name='''extended_gcd''', verbose=True)
						testmod(name='''greatest_common_divisor''', verbose=True)










from collections import OrderedDict
from typing import Mapping

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


A__						:						int          =      logging.get_logger(__name__)

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



class        __snake_case		(  UpperCamelCase_		):
							_a       =				'''mega'''




							def __init__( self  : Any       ,       A_  : Dict=3_0_5_2_2       ,       A_  : int=1_2_8       ,       A_  : str=4       ,       A_  : int=2_5_6       ,       A_  : int=1_6       ,       A_  : str=True       ,       A_  : List[str]=6_4       ,       A_  : Optional[Any]=False       ,       A_  : str=-1       ,       A_  : Optional[int]=None       ,       A_  : Tuple=True       ,       A_  : Tuple="scalenorm"       ,       A_  : Optional[Any]=True       ,       A_  : int="silu"       ,       A_  : Optional[int]="softmax"       ,       A_  : Optional[int]=0.1       ,       A_  : Union[str, Any]=0.1       ,       A_  : Any=0.1       ,       A_  : Dict=False       ,       A_  : int=True       ,       A_  : Tuple=2_5_6       ,       A_  : int=True       ,       A_  : List[Any]=0.1       ,       A_  : Optional[Any]=2_0_4_8       ,       A_  : Dict=False       ,       A_  : Dict=2       ,       A_  : Tuple=0.02       ,       A_  : List[Any]=0.2       ,       A_  : str=0.02       ,       A_  : List[str]=1.0       ,       A_  : Union[str, Any]=1       ,       A_  : List[Any]=0       ,       A_  : int=2       ,       A_  : Tuple="rotary"       ,       A_  : Any=None       ,       A_  : Tuple=True       ,       A_  : Any=True       ,       **A_  : Optional[int]       ,       ):
									super().__init__(pad_token_id=A_       ,       bos_token_id=A_       ,       eos_token_id=A_       ,       **A_)

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





class        __snake_case		(  UpperCamelCase_		):




							@property
							def      UpperCAmelCase__    ( self  : Any):
									if self.task == "multiple-choice":
											lowerCAmelCase_    :  Dict             =				{0: '''batch''', 1: '''choice''', 2: '''sequence'''}
									else:
											lowerCAmelCase_    :  int             =				{0: '''batch''', 1: '''sequence'''}
									return OrderedDict(
									    [
									        ('''input_ids''', dynamic_axis),
									        ('''attention_mask''', dynamic_axis),
									    ])





