






from collections import OrderedDict
from typing import Mapping

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


__lowerCamelCase						= logging.get_logger(__name__)

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

class      UpperCamelCase_							(				UpperCamelCase       ):
						lowercase									=  '''mega'''




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

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

class      UpperCamelCase_							(				UpperCamelCase       ):




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







def    UpperCamelCase__  (   UpperCAmelCase     )     ->		tuple[int, int]:







							"""simple docstring"""





							if len(UpperCAmelCase     ) == 1:
														return a[0], a[0]
							else:
														# split A into half.
														_a  :    Union[str, Any]			=						a[: len(UpperCAmelCase     ) // 2]
														_a  :    Optional[Any]			=						a[len(UpperCAmelCase     ) // 2 :]

														# 2 sub problems, 1/2 of original size.
														_a		,					_a  :    Union[str, Any]			=						max_difference(UpperCAmelCase     )
														_a		,					_a  :    List[Any]			=						max_difference(UpperCAmelCase     )

														# get min of first and max of second
														# linear time
														_a  :    Union[str, Any]			=						min(UpperCAmelCase     )
														_a  :    Any			=						max(UpperCAmelCase     )

														# 3 cases, either (small1, big1),
														# (min_first, max_second), (small2, big2)
														# constant comparisons
														if biga - smalla > max_second - min_first and biga - smalla > biga - smalla:
																					return smalla, biga
														elif biga - smalla > max_second - min_first:
																					return smalla, biga
														else:
																					return min_first, max_second


if __name__ == "__main__":
						import doctest

						doctest.testmod()