

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







class 				A__       (			nn.Module    ):
  A__											=							42
  A__											=							jnp.floataa





  def 		A    (						self :      Optional[Any]					)      ->       Dict:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE				       =nn.Conv(
           self.out_channels				,   kernel_size=(3, 3)				,   strides=(1, 1)				,   padding=((1, 1), (1, 1))				,   dtype=self.dtype				,   )





  def __call__(						self :      int				,   _a :      Tuple					)      ->       List[str]:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE				       =hidden_states.shape
       _SCREAMING_SNAKE_CASE				       =jax.image.resize(
           A__				,   shape=(batch, height * 2, width * 2, channels)				,   method='nearest'				,   )
       _SCREAMING_SNAKE_CASE				       =self.conv(A__					)
       return hidden_states







class 				A__       (			nn.Module    ):
  A__											=							42
  A__											=							jnp.floataa





  def 		A    (						self :      Tuple					)      ->       int:





       '''simple docstring'''






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





  def __call__(						self :      List[Any]				,   _a :      int					)      ->       str:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE				       =self.conv(A__					)
       return hidden_states







class 				A__       (			nn.Module    ):
  A__											=							42
  A__											=							None
  A__											=							0.0
  A__											=							None
  A__											=							jnp.floataa





  def 		A    (						self :      Optional[Any]					)      ->       List[Any]:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE				       =self.in_channels if self.out_channels is None else self.out_channels

       _SCREAMING_SNAKE_CASE				       =nn.GroupNorm(num_groups=32				,   epsilon=1e-5					)
       _SCREAMING_SNAKE_CASE				       =nn.Conv(
           A__				,   kernel_size=(3, 3)				,   strides=(1, 1)				,   padding=((1, 1), (1, 1))				,   dtype=self.dtype				,   )

       _SCREAMING_SNAKE_CASE				       =nn.Dense(A__				,   dtype=self.dtype					)

       _SCREAMING_SNAKE_CASE				       =nn.GroupNorm(num_groups=32				,   epsilon=1e-5					)
       _SCREAMING_SNAKE_CASE				       =nn.Dropout(self.dropout_prob					)
       _SCREAMING_SNAKE_CASE				       =nn.Conv(
           A__				,   kernel_size=(3, 3)				,   strides=(1, 1)				,   padding=((1, 1), (1, 1))				,   dtype=self.dtype				,   )

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

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





  def __call__(						self :      str				,   _a :      str				,   _a :      Optional[int]				,   _a :      Union[str, Any]=True					)      ->       Tuple:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE				       =hidden_states
       _SCREAMING_SNAKE_CASE				       =self.norma(A__					)
       _SCREAMING_SNAKE_CASE				       =nn.swish(A__					)
       _SCREAMING_SNAKE_CASE				       =self.conva(A__					)

       _SCREAMING_SNAKE_CASE				       =self.time_emb_proj(nn.swish(A__					)					)
       _SCREAMING_SNAKE_CASE				       =jnp.expand_dims(jnp.expand_dims(A__				,   1					)				,   1					)
       _SCREAMING_SNAKE_CASE				       =hidden_states + temb

       _SCREAMING_SNAKE_CASE				       =self.norma(A__					)
       _SCREAMING_SNAKE_CASE				       =nn.swish(A__					)
       _SCREAMING_SNAKE_CASE				       =self.dropout(A__				,   A__					)
       _SCREAMING_SNAKE_CASE				       =self.conva(A__					)

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

       return hidden_states + residual








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


_UpperCamelCase			:	Optional[int]								=logging.get_logger(__name__)

_UpperCamelCase			:	Tuple								={
    'google/canine-s': 'https://huggingface.co/google/canine-s/resolve/main/config.json',
    # See all CANINE models at https://huggingface.co/models?filter=canine
}






class 						UpperCAmelCase__ (							__snake_case							):
		__snake_case      :       Any     =   "canine"







		def __init__(					self       ,A__=768       ,A__=12       ,A__=12       ,A__=3072       ,A__="gelu"       ,A__=0.1       ,A__=0.1       ,A__=16384       ,A__=16       ,A__=0.02       ,A__=1E-12       ,A__=0       ,A__=0xE_000       ,A__=0xE_001       ,A__=4       ,A__=4       ,A__=8       ,A__=16384       ,A__=128       ,**A__       ,):
						super().__init__(pad_token_id=A__       ,bos_token_id=A__       ,eos_token_id=A__       ,**A__		)

						_A	:				int   =      max_position_embeddings
						_A	:				Dict   =      hidden_size
						_A	:				List[str]   =      num_hidden_layers
						_A	:				Optional[Any]   =      num_attention_heads
						_A	:				Optional[Any]   =      intermediate_size
						_A	:				Optional[Any]   =      hidden_act
						_A	:				str   =      hidden_dropout_prob
						_A	:				Optional[int]   =      attention_probs_dropout_prob
						_A	:				Union[str, Any]   =      initializer_range
						_A	:				Dict   =      type_vocab_size
						_A	:				Optional[Any]   =      layer_norm_eps

						# Character config:
						_A	:				Union[str, Any]   =      downsampling_rate
						_A	:				List[str]   =      upsampling_kernel_size
						_A	:				str   =      num_hash_functions
						_A	:				Optional[Any]   =      num_hash_buckets
						_A	:				Optional[Any]   =      local_transformer_stride



