
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 			lowercase__(    UpperCAmelCase							):



	"""simple docstring"""




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

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

class 			lowercase__(    UpperCAmelCase							):



	"""simple docstring"""




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






from typing import TYPE_CHECKING

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


__a        = {
    'configuration_donut_swin': ['DONUT_SWIN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'DonutSwinConfig'],
    'processing_donut': ['DonutProcessor'],
}

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						__a        = [
						    'DONUT_SWIN_PRETRAINED_MODEL_ARCHIVE_LIST',
						    'DonutSwinModel',
						    'DonutSwinPreTrainedModel',
						]

try:
						if not is_vision_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						__a        = ['DonutFeatureExtractor']
						__a        = ['DonutImageProcessor']


if TYPE_CHECKING:
						from .configuration_donut_swin import DONUT_SWIN_PRETRAINED_CONFIG_ARCHIVE_MAP, DonutSwinConfig
						from .processing_donut import DonutProcessor

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_donut_swin import (
												    DONUT_SWIN_PRETRAINED_MODEL_ARCHIVE_LIST,
												    DonutSwinModel,
												    DonutSwinPreTrainedModel,
												)

						try:
												if not is_vision_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .feature_extraction_donut import DonutFeatureExtractor
												from .image_processing_donut import DonutImageProcessor

else:
						import sys

						__a        = _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)




