





'''simple docstring'''







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


snake_case_     :       Tuple						=  logging.get_logger(__name__)

snake_case_     :       int						=  {
    "weiweishi/roc-bert-base-zh": "https://huggingface.co/weiweishi/roc-bert-base-zh/resolve/main/config.json",
}


class 					__a      (lowerCamelCase     ):
							__a					:   Union[str, Any]									=       "roc_bert"

							def __init__(							self							:     Dict       ,     __magic_name__							:     Tuple=3_05_22       ,     __magic_name__							:     Optional[Any]=7_68       ,     __magic_name__							:     Dict=12       ,     __magic_name__							:     Tuple=12       ,     __magic_name__							:     Dict=30_72       ,     __magic_name__							:     List[str]="gelu"       ,     __magic_name__							:     Any=0.1       ,     __magic_name__							:     List[Any]=0.1       ,     __magic_name__							:     Optional[Any]=5_12       ,     __magic_name__							:     Optional[Any]=2       ,     __magic_name__							:     Union[str, Any]=0.0_2       ,     __magic_name__							:     Any=1E-12       ,     __magic_name__							:     List[Any]=True       ,     __magic_name__							:     Any=0       ,     __magic_name__							:     Optional[Any]="absolute"       ,     __magic_name__							:     List[str]=None       ,     __magic_name__							:     Tuple=True       ,     __magic_name__							:     Optional[Any]=True       ,     __magic_name__							:     int=7_68       ,     __magic_name__							:     Tuple=9_10       ,     __magic_name__							:     str=5_12       ,     __magic_name__							:     Optional[int]=2_48_58       ,     __magic_name__							:     Optional[Any]=True       ,     **__magic_name__							:     Union[str, Any]       ,     )					->       Dict:







													"""simple docstring"""
													UpperCAmelCase_			:      List[Any]     						=  vocab_size
													UpperCAmelCase_			:      List[str]     						=  max_position_embeddings
													UpperCAmelCase_			:      Optional[Any]     						=  hidden_size
													UpperCAmelCase_			:      Any     						=  num_hidden_layers
													UpperCAmelCase_			:      int     						=  num_attention_heads
													UpperCAmelCase_			:      Optional[Any]     						=  intermediate_size
													UpperCAmelCase_			:      int     						=  hidden_act
													UpperCAmelCase_			:      int     						=  hidden_dropout_prob
													UpperCAmelCase_			:      str     						=  attention_probs_dropout_prob
													UpperCAmelCase_			:      Optional[int]     						=  initializer_range
													UpperCAmelCase_			:      Dict     						=  type_vocab_size
													UpperCAmelCase_			:      str     						=  layer_norm_eps
													UpperCAmelCase_			:      int     						=  use_cache
													UpperCAmelCase_			:      int     						=  enable_pronunciation
													UpperCAmelCase_			:      List[Any]     						=  enable_shape
													UpperCAmelCase_			:      int     						=  pronunciation_embed_dim
													UpperCAmelCase_			:      Union[str, Any]     						=  pronunciation_vocab_size
													UpperCAmelCase_			:      Optional[int]     						=  shape_embed_dim
													UpperCAmelCase_			:      Optional[Any]     						=  shape_vocab_size
													UpperCAmelCase_			:      List[str]     						=  concat_input
													UpperCAmelCase_			:      Dict     						=  position_embedding_type
													UpperCAmelCase_			:      Tuple     						=  classifier_dropout
													super().__init__(pad_token_id=__magic_name__       ,     **__magic_name__   )












'''simple docstring'''







import unittest

import torch
from torch import nn

from diffusers.models.activations import get_activation


class 					__a      (unittest.TestCase     ):

							def     UpperCAmelCase__	(							self							:     Dict   )					->       Dict:







													"""simple docstring"""
													UpperCAmelCase_			:      Dict     						=  get_activation('''swish'''   )

													self.assertIsInstance(__magic_name__       ,     nn.SiLU   )

													self.assertEqual(act(torch.tensor(-1_00       ,     dtype=torch.floataa   )   ).item()       ,     0   )
													self.assertNotEqual(act(torch.tensor(-1       ,     dtype=torch.floataa   )   ).item()       ,     0   )
													self.assertEqual(act(torch.tensor(0       ,     dtype=torch.floataa   )   ).item()       ,     0   )
													self.assertEqual(act(torch.tensor(20       ,     dtype=torch.floataa   )   ).item()       ,     20   )

							def     UpperCAmelCase__	(							self							:     Tuple   )					->       Tuple:







													"""simple docstring"""
													UpperCAmelCase_			:      Union[str, Any]     						=  get_activation('''silu'''   )

													self.assertIsInstance(__magic_name__       ,     nn.SiLU   )

													self.assertEqual(act(torch.tensor(-1_00       ,     dtype=torch.floataa   )   ).item()       ,     0   )
													self.assertNotEqual(act(torch.tensor(-1       ,     dtype=torch.floataa   )   ).item()       ,     0   )
													self.assertEqual(act(torch.tensor(0       ,     dtype=torch.floataa   )   ).item()       ,     0   )
													self.assertEqual(act(torch.tensor(20       ,     dtype=torch.floataa   )   ).item()       ,     20   )

							def     UpperCAmelCase__	(							self							:     Tuple   )					->       Optional[int]:







													"""simple docstring"""
													UpperCAmelCase_			:      Optional[int]     						=  get_activation('''mish'''   )

													self.assertIsInstance(__magic_name__       ,     nn.Mish   )

													self.assertEqual(act(torch.tensor(-2_00       ,     dtype=torch.floataa   )   ).item()       ,     0   )
													self.assertNotEqual(act(torch.tensor(-1       ,     dtype=torch.floataa   )   ).item()       ,     0   )
													self.assertEqual(act(torch.tensor(0       ,     dtype=torch.floataa   )   ).item()       ,     0   )
													self.assertEqual(act(torch.tensor(20       ,     dtype=torch.floataa   )   ).item()       ,     20   )



							def     UpperCAmelCase__	(							self							:     str   )					->       Optional[Any]:







													"""simple docstring"""
													UpperCAmelCase_			:      List[Any]     						=  get_activation('''gelu'''   )

													self.assertIsInstance(__magic_name__       ,     nn.GELU   )

													self.assertEqual(act(torch.tensor(-1_00       ,     dtype=torch.floataa   )   ).item()       ,     0   )
													self.assertNotEqual(act(torch.tensor(-1       ,     dtype=torch.floataa   )   ).item()       ,     0   )
													self.assertEqual(act(torch.tensor(0       ,     dtype=torch.floataa   )   ).item()       ,     0   )
													self.assertEqual(act(torch.tensor(20       ,     dtype=torch.floataa   )   ).item()       ,     20   )





