



"""simple docstring"""
import flax.linen as nn
import jax
import jax.numpy as jnp



class       SCREAMING_SNAKE_CASE__  (					nn.Module ):
   __lowerCAmelCase  :   int
   __lowerCAmelCase  :   jnp.dtype						=						jnp.floataa

   def 	SCREAMING_SNAKE_CASE     (   self						)  ->      Tuple:





    '''simple docstring'''




    UpperCAmelCase	:					List[str]	=	nn.Conv(
        self.out_channels      ,     kernel_size=(3, 3)      ,     strides=(1, 1)      ,     padding=((1, 1), (1, 1))      ,     dtype=self.dtype      ,     )




   def __call__(   self      ,     _SCREAMING_SNAKE_CASE						)  ->      Optional[Any]:





    '''simple docstring'''




    UpperCAmelCase	,		UpperCAmelCase	,		UpperCAmelCase	,		UpperCAmelCase	:					Dict	=	hidden_states.shape
    UpperCAmelCase	:					str	=	jax.image.resize(
        _SCREAMING_SNAKE_CASE      ,     shape=(batch, height * 2, width * 2, channels)      ,     method="""nearest"""      ,     )
    UpperCAmelCase	:					Optional[int]	=	self.conv(_SCREAMING_SNAKE_CASE						)
    return hidden_states



class       SCREAMING_SNAKE_CASE__  (					nn.Module ):
   __lowerCAmelCase  :   int
   __lowerCAmelCase  :   jnp.dtype						=						jnp.floataa

   def 	SCREAMING_SNAKE_CASE     (   self						)  ->      List[str]:





    '''simple docstring'''




    UpperCAmelCase	:					Tuple	=	nn.Conv(
        self.out_channels      ,     kernel_size=(3, 3)      ,     strides=(2, 2)      ,     padding=((1, 1), (1, 1))      ,     dtype=self.dtype      ,     )




   def __call__(   self      ,     _SCREAMING_SNAKE_CASE						)  ->      Any:





    '''simple docstring'''




    UpperCAmelCase	:					Any	=	self.conv(_SCREAMING_SNAKE_CASE						)
    return hidden_states



class       SCREAMING_SNAKE_CASE__  (					nn.Module ):
   __lowerCAmelCase  :   int
   __lowerCAmelCase  :   int						=						None
   __lowerCAmelCase  :   float						=						0.0
   __lowerCAmelCase  :   bool						=						None
   __lowerCAmelCase  :   jnp.dtype						=						jnp.floataa

   def 	SCREAMING_SNAKE_CASE     (   self						)  ->      List[str]:





    '''simple docstring'''




    UpperCAmelCase	:					Optional[Any]	=	self.in_channels if self.out_channels is None else self.out_channels

    UpperCAmelCase	:					Any	=	nn.GroupNorm(num_groups=32      ,     epsilon=1E-5						)
    UpperCAmelCase	:					Optional[Any]	=	nn.Conv(
        _SCREAMING_SNAKE_CASE      ,     kernel_size=(3, 3)      ,     strides=(1, 1)      ,     padding=((1, 1), (1, 1))      ,     dtype=self.dtype      ,     )

    UpperCAmelCase	:					str	=	nn.Dense(_SCREAMING_SNAKE_CASE      ,     dtype=self.dtype						)

    UpperCAmelCase	:					str	=	nn.GroupNorm(num_groups=32      ,     epsilon=1E-5						)
    UpperCAmelCase	:					List[str]	=	nn.Dropout(self.dropout_prob						)
    UpperCAmelCase	:					str	=	nn.Conv(
        _SCREAMING_SNAKE_CASE      ,     kernel_size=(3, 3)      ,     strides=(1, 1)      ,     padding=((1, 1), (1, 1))      ,     dtype=self.dtype      ,     )

    UpperCAmelCase	:					Tuple	=	self.in_channels != out_channels if self.use_nin_shortcut is None else self.use_nin_shortcut

    UpperCAmelCase	:					Dict	=	None
    if use_nin_shortcut:
     UpperCAmelCase	:					str	=	nn.Conv(
         _SCREAMING_SNAKE_CASE      ,     kernel_size=(1, 1)      ,     strides=(1, 1)      ,     padding="""VALID"""      ,     dtype=self.dtype      ,     )




   def __call__(   self      ,     _SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE=True						)  ->      List[Any]:





    '''simple docstring'''




    UpperCAmelCase	:					Tuple	=	hidden_states
    UpperCAmelCase	:					Dict	=	self.norma(_SCREAMING_SNAKE_CASE						)
    UpperCAmelCase	:					Tuple	=	nn.swish(_SCREAMING_SNAKE_CASE						)
    UpperCAmelCase	:					Optional[int]	=	self.conva(_SCREAMING_SNAKE_CASE						)

    UpperCAmelCase	:					str	=	self.time_emb_proj(nn.swish(_SCREAMING_SNAKE_CASE						)						)
    UpperCAmelCase	:					Optional[int]	=	jnp.expand_dims(jnp.expand_dims(_SCREAMING_SNAKE_CASE      ,     1						)      ,     1						)
    UpperCAmelCase	:					Union[str, Any]	=	hidden_states + temb

    UpperCAmelCase	:					Any	=	self.norma(_SCREAMING_SNAKE_CASE						)
    UpperCAmelCase	:					Union[str, Any]	=	nn.swish(_SCREAMING_SNAKE_CASE						)
    UpperCAmelCase	:					int	=	self.dropout(_SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE						)
    UpperCAmelCase	:					Tuple	=	self.conva(_SCREAMING_SNAKE_CASE						)

    if self.conv_shortcut is not None:
     UpperCAmelCase	:					Dict	=	self.conv_shortcut(_SCREAMING_SNAKE_CASE						)

    return hidden_states + residual


'''simple docstring'''




from collections import OrderedDict
from typing import Mapping

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


lowercase			:				Union[str, Any]    		=			logging.get_logger(__name__)

lowercase			:				str    		=			{
    'bert-base-uncased': 'https://huggingface.co/bert-base-uncased/resolve/main/config.json',
    'bert-large-uncased': 'https://huggingface.co/bert-large-uncased/resolve/main/config.json',
    'bert-base-cased': 'https://huggingface.co/bert-base-cased/resolve/main/config.json',
    'bert-large-cased': 'https://huggingface.co/bert-large-cased/resolve/main/config.json',
    'bert-base-multilingual-uncased': 'https://huggingface.co/bert-base-multilingual-uncased/resolve/main/config.json',
    'bert-base-multilingual-cased': 'https://huggingface.co/bert-base-multilingual-cased/resolve/main/config.json',
    'bert-base-chinese': 'https://huggingface.co/bert-base-chinese/resolve/main/config.json',
    'bert-base-german-cased': 'https://huggingface.co/bert-base-german-cased/resolve/main/config.json',
    'bert-large-uncased-whole-word-masking': (
        'https://huggingface.co/bert-large-uncased-whole-word-masking/resolve/main/config.json'
    ),
    'bert-large-cased-whole-word-masking': (
        'https://huggingface.co/bert-large-cased-whole-word-masking/resolve/main/config.json'
    ),
    'bert-large-uncased-whole-word-masking-finetuned-squad': (
        'https://huggingface.co/bert-large-uncased-whole-word-masking-finetuned-squad/resolve/main/config.json'
    ),
    'bert-large-cased-whole-word-masking-finetuned-squad': (
        'https://huggingface.co/bert-large-cased-whole-word-masking-finetuned-squad/resolve/main/config.json'
    ),
    'bert-base-cased-finetuned-mrpc': 'https://huggingface.co/bert-base-cased-finetuned-mrpc/resolve/main/config.json',
    'bert-base-german-dbmdz-cased': 'https://huggingface.co/bert-base-german-dbmdz-cased/resolve/main/config.json',
    'bert-base-german-dbmdz-uncased': 'https://huggingface.co/bert-base-german-dbmdz-uncased/resolve/main/config.json',
    'cl-tohoku/bert-base-japanese': 'https://huggingface.co/cl-tohoku/bert-base-japanese/resolve/main/config.json',
    'cl-tohoku/bert-base-japanese-whole-word-masking': (
        'https://huggingface.co/cl-tohoku/bert-base-japanese-whole-word-masking/resolve/main/config.json'
    ),
    'cl-tohoku/bert-base-japanese-char': (
        'https://huggingface.co/cl-tohoku/bert-base-japanese-char/resolve/main/config.json'
    ),
    'cl-tohoku/bert-base-japanese-char-whole-word-masking': (
        'https://huggingface.co/cl-tohoku/bert-base-japanese-char-whole-word-masking/resolve/main/config.json'
    ),
    'TurkuNLP/bert-base-finnish-cased-v1': (
        'https://huggingface.co/TurkuNLP/bert-base-finnish-cased-v1/resolve/main/config.json'
    ),
    'TurkuNLP/bert-base-finnish-uncased-v1': (
        'https://huggingface.co/TurkuNLP/bert-base-finnish-uncased-v1/resolve/main/config.json'
    ),
    'wietsedv/bert-base-dutch-cased': 'https://huggingface.co/wietsedv/bert-base-dutch-cased/resolve/main/config.json',
    # See all BERT models at https://huggingface.co/models?filter=bert
}





class  A				(							__snake_case						):
     __magic_name__						=		'''bert'''





     def __init__(							self						,			SCREAMING_SNAKE_CASE=30522						,			SCREAMING_SNAKE_CASE=768						,			SCREAMING_SNAKE_CASE=12						,			SCREAMING_SNAKE_CASE=12						,			SCREAMING_SNAKE_CASE=3072						,			SCREAMING_SNAKE_CASE="gelu"						,			SCREAMING_SNAKE_CASE=0.1						,			SCREAMING_SNAKE_CASE=0.1						,			SCREAMING_SNAKE_CASE=512						,			SCREAMING_SNAKE_CASE=2						,			SCREAMING_SNAKE_CASE=0.02						,			SCREAMING_SNAKE_CASE=1e-12						,			SCREAMING_SNAKE_CASE=0						,			SCREAMING_SNAKE_CASE="absolute"						,			SCREAMING_SNAKE_CASE=True						,			SCREAMING_SNAKE_CASE=None						,			**SCREAMING_SNAKE_CASE						,			) ->				Optional[int]:






         """simple docstring"""






         super().__init__(pad_token_id=SCREAMING_SNAKE_CASE						,			**SCREAMING_SNAKE_CASE	)

         A       :   Optional[int]					=						vocab_size
         A       :   Optional[Any]					=						hidden_size
         A       :   List[Any]					=						num_hidden_layers
         A       :   List[str]					=						num_attention_heads
         A       :   Dict					=						hidden_act
         A       :   Optional[Any]					=						intermediate_size
         A       :   List[Any]					=						hidden_dropout_prob
         A       :   List[Any]					=						attention_probs_dropout_prob
         A       :   Optional[Any]					=						max_position_embeddings
         A       :   List[str]					=						type_vocab_size
         A       :   Dict					=						initializer_range
         A       :   str					=						layer_norm_eps
         A       :   int					=						position_embedding_type
         A       :   Dict					=						use_cache
         A       :   str					=						classifier_dropout





class  A				(							__snake_case						):





     @property
     def 				__lowerCAmelCase							(							self	) ->				Mapping[str, Mapping[int, str]]:






         """simple docstring"""






         if self.task == "multiple-choice":
             A       :   Optional[Any]					=						{0: '''batch''', 1: '''choice''', 2: '''sequence'''}
         else:
             A       :   Optional[int]					=						{0: '''batch''', 1: '''sequence'''}
         return OrderedDict(
             [
                 ('''input_ids''', dynamic_axis),
                 ('''attention_mask''', dynamic_axis),
                 ('''token_type_ids''', dynamic_axis),
             ]	)




