
import flax.linen as nn
import jax
import jax.numpy as jnp
class  lowercase__(				nn.Module							):



	"""simple docstring"""




	a			:int
	a			:jnp.dtype         =	jnp.floataa
	def 						_lowercase  (       self  :			List[Any]       )       ->     Union[str, Any]:
					lowercase_       =					nn.Conv(
					    self.out_channels       ,							kernel_size=(3, 3)       ,							strides=(1, 1)       ,							padding=((1, 1), (1, 1))       ,							dtype=self.dtype       ,							)




	def __call__(       self  :			str       ,							SCREAMING_SNAKE_CASE_  :			Optional[Any]       )       ->     Optional[int]:
					lowercase_  ,	lowercase_  ,	lowercase_  ,	lowercase_       =					hidden_states.shape
					lowercase_       =					jax.image.resize(
					    SCREAMING_SNAKE_CASE_       ,							shape=(batch, height * 2, width * 2, channels)       ,							method='''nearest'''       ,							)
					lowercase_       =					self.conv(SCREAMING_SNAKE_CASE_       )
					return hidden_states

class  lowercase__(				nn.Module							):



	"""simple docstring"""




	a			:int
	a			:jnp.dtype         =	jnp.floataa
	def 						_lowercase  (       self  :			Union[str, Any]       )       ->     Union[str, Any]:
					lowercase_       =					nn.Conv(
					    self.out_channels       ,							kernel_size=(3, 3)       ,							strides=(2, 2)       ,							padding=((1, 1), (1, 1))       ,							dtype=self.dtype       ,							)




	def __call__(       self  :			Tuple       ,							SCREAMING_SNAKE_CASE_  :			Dict       )       ->     List[str]:
					# pad = ((0, 0), (0, 1), (0, 1), (0, 0))  # pad height and width dim
					# hidden_states = jnp.pad(hidden_states, pad_width=pad)
					lowercase_       =					self.conv(SCREAMING_SNAKE_CASE_       )
					return hidden_states

class  lowercase__(				nn.Module							):



	"""simple docstring"""




	a			:int
	a			:int         =	None
	a			:float         =	0.0
	a			:bool         =	None
	a			:jnp.dtype         =	jnp.floataa
	def 						_lowercase  (       self  :			Any       )       ->     List[str]:
					lowercase_       =					self.in_channels if self.out_channels is None else self.out_channels

					lowercase_       =					nn.GroupNorm(num_groups=3_2       ,							epsilon=1e-5       )
					lowercase_       =					nn.Conv(
					    SCREAMING_SNAKE_CASE_       ,							kernel_size=(3, 3)       ,							strides=(1, 1)       ,							padding=((1, 1), (1, 1))       ,							dtype=self.dtype       ,							)

					lowercase_       =					nn.Dense(SCREAMING_SNAKE_CASE_       ,							dtype=self.dtype       )

					lowercase_       =					nn.GroupNorm(num_groups=3_2       ,							epsilon=1e-5       )
					lowercase_       =					nn.Dropout(self.dropout_prob       )
					lowercase_       =					nn.Conv(
					    SCREAMING_SNAKE_CASE_       ,							kernel_size=(3, 3)       ,							strides=(1, 1)       ,							padding=((1, 1), (1, 1))       ,							dtype=self.dtype       ,							)

					lowercase_       =					self.in_channels != out_channels if self.use_nin_shortcut is None else self.use_nin_shortcut

					lowercase_       =					None
					if use_nin_shortcut:
									lowercase_       =					nn.Conv(
									    SCREAMING_SNAKE_CASE_       ,							kernel_size=(1, 1)       ,							strides=(1, 1)       ,							padding='''VALID'''       ,							dtype=self.dtype       ,							)




	def __call__(       self  :			Union[str, Any]       ,							SCREAMING_SNAKE_CASE_  :			Dict       ,							SCREAMING_SNAKE_CASE_  :			Any       ,							SCREAMING_SNAKE_CASE_  :			Optional[int]=True       )       ->     Tuple:
					lowercase_       =					hidden_states
					lowercase_       =					self.norma(SCREAMING_SNAKE_CASE_       )
					lowercase_       =					nn.swish(SCREAMING_SNAKE_CASE_       )
					lowercase_       =					self.conva(SCREAMING_SNAKE_CASE_       )

					lowercase_       =					self.time_emb_proj(nn.swish(SCREAMING_SNAKE_CASE_       )       )
					lowercase_       =					jnp.expand_dims(jnp.expand_dims(SCREAMING_SNAKE_CASE_       ,							1       )       ,							1       )
					lowercase_       =					hidden_states + temb

					lowercase_       =					self.norma(SCREAMING_SNAKE_CASE_       )
					lowercase_       =					nn.swish(SCREAMING_SNAKE_CASE_       )
					lowercase_       =					self.dropout(SCREAMING_SNAKE_CASE_       ,							SCREAMING_SNAKE_CASE_       )
					lowercase_       =					self.conva(SCREAMING_SNAKE_CASE_       )

					if self.conv_shortcut is not None:
									lowercase_       =					self.conv_shortcut(SCREAMING_SNAKE_CASE_       )

					return hidden_states + residual






from collections import OrderedDict
from typing import Mapping

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


snake_case :		Dict							      =  logging.get_logger(__name__)

snake_case :		List[Any]							      =  {
    "YituTech/conv-bert-base": "https://huggingface.co/YituTech/conv-bert-base/resolve/main/config.json",
    "YituTech/conv-bert-medium-small": (
        "https://huggingface.co/YituTech/conv-bert-medium-small/resolve/main/config.json"
    ),
    "YituTech/conv-bert-small": "https://huggingface.co/YituTech/conv-bert-small/resolve/main/config.json",
    # See all ConvBERT models at https://huggingface.co/models?filter=convbert
}





class       _snake_case					(     snake_case				):
			UpperCamelCase__          =    'convbert'







			def __init__(				self						,   _a=30_522						,   _a=768						,   _a=12						,   _a=12						,   _a=3_072						,   _a="gelu"						,   _a=0.1						,   _a=0.1						,   _a=512						,   _a=2						,   _a=0.02						,   _a=1e-12						,   _a=1						,   _a=0						,   _a=2						,   _a=768						,   _a=2						,   _a=9						,   _a=1						,   _a=None						,   **_a						,   ):
				super().__init__(
				    pad_token_id=_a						,   bos_token_id=_a						,   eos_token_id=_a						,   **_a						,   )

				__magic_name__		:		Tuple	   =     vocab_size
				__magic_name__		:		List[Any]	   =     hidden_size
				__magic_name__		:		Union[str, Any]	   =     num_hidden_layers
				__magic_name__		:		List[Any]	   =     num_attention_heads
				__magic_name__		:		str	   =     intermediate_size
				__magic_name__		:		Any	   =     hidden_act
				__magic_name__		:		List[Any]	   =     hidden_dropout_prob
				__magic_name__		:		Optional[int]	   =     attention_probs_dropout_prob
				__magic_name__		:		Tuple	   =     max_position_embeddings
				__magic_name__		:		str	   =     type_vocab_size
				__magic_name__		:		List[str]	   =     initializer_range
				__magic_name__		:		Tuple	   =     layer_norm_eps
				__magic_name__		:		List[Any]	   =     embedding_size
				__magic_name__		:		List[Any]	   =     head_ratio
				__magic_name__		:		str	   =     conv_kernel_size
				__magic_name__		:		Dict	   =     num_groups
				__magic_name__		:		str	   =     classifier_dropout







class       _snake_case					(     snake_case				):







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