






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   SCREAMING_SNAKE_CASE (       snake_case    ):





							"""simple docstring"""

							A_       =    "mega"

							def __init__(     self:      Union[str, Any]						,   __A:      int=3_05_22						,   __A:      Tuple=1_28						,   __A:      Union[str, Any]=4						,   __A:      Union[str, Any]=2_56						,   __A:      int=16						,   __A:      Optional[Any]=True						,   __A:      Any=64						,   __A:      Dict=False						,   __A:      List[Any]=-1						,   __A:      Any=None						,   __A:      Dict=True						,   __A:      Tuple="scalenorm"						,   __A:      Tuple=True						,   __A:      int="silu"						,   __A:      Optional[int]="softmax"						,   __A:      Dict=0.1						,   __A:      Optional[int]=0.1						,   __A:      List[Any]=0.1						,   __A:      str=False						,   __A:      Optional[Any]=True						,   __A:      Optional[Any]=2_56						,   __A:      Optional[Any]=True						,   __A:      Optional[Any]=0.1						,   __A:      Optional[int]=20_48						,   __A:      Tuple=False						,   __A:      Any=2						,   __A:      Dict=0.02						,   __A:      Union[str, Any]=0.2						,   __A:      Tuple=0.02						,   __A:      Any=1.0						,   __A:      str=1						,   __A:      List[str]=0						,   __A:      Any=2						,   __A:      Tuple="rotary"						,   __A:      Optional[int]=None						,   __A:      Any=True						,   __A:      Optional[int]=True						,   **__A:      Union[str, Any]						,   )			-> int:
												super().__init__(pad_token_id=__A						,   bos_token_id=__A						,   eos_token_id=__A						,   **__A      )

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





class   SCREAMING_SNAKE_CASE (       snake_case    ):





							"""simple docstring"""

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




"""simple docstring"""


import copy

from transformers.configuration_utils import PretrainedConfig
from transformers.utils import logging


a							=logging.get_logger(__name__)






class    __UpperCAmelCase						(	__lowerCAmelCase	):
				A__      :   Any  							=       '''hybrid-clip'''
				A__      :   Optional[Any]  							=       True

				def __init__(      self	, _lowerCamelCase=512	, **_lowerCamelCase      ):
										super().__init__(**_lowerCamelCase      )

										if "text_config" not in kwargs:
																raise ValueError("`text_config` can not be `None`."      )

										if "vision_config" not in kwargs:
																raise ValueError("`vision_config` can not be `None`."      )

										lowerCamelCase__					=kwargs.pop("text_config"      )
										lowerCamelCase__					=kwargs.pop("vision_config"      )

										lowerCamelCase__					=text_config.pop("model_type"      )
										lowerCamelCase__					=vision_config.pop("model_type"      )

										from transformers import AutoConfig

										lowerCamelCase__					=AutoConfig.for_model(_lowerCamelCase	, **_lowerCamelCase      )

										if vision_model_type == "clip":
																lowerCamelCase__					=AutoConfig.for_model(_lowerCamelCase	, **_lowerCamelCase      ).vision_config
										elif vision_model_type == "clip_vision_model":
																from transformers import CLIPVisionConfig

																lowerCamelCase__					=CLIPVisionConfig(**_lowerCamelCase      )
										else:
																lowerCamelCase__					=AutoConfig.for_model(_lowerCamelCase	, **_lowerCamelCase      )

										lowerCamelCase__					=projection_dim
										lowerCamelCase__					=1.0

				@classmethod
				def 		_a	(      cls	, _lowerCamelCase	, _lowerCamelCase	, **_lowerCamelCase      ):
										return cls(text_config=text_config.to_dict()	, vision_config=vision_config.to_dict()	, **_lowerCamelCase      )






				def 		_a	(      self      ):
										lowerCamelCase__					=copy.deepcopy(self.__dict__      )
										lowerCamelCase__					=self.text_config.to_dict()
										lowerCamelCase__					=self.vision_config.to_dict()
										lowerCamelCase__					=self.__class__.model_type
										return output


