





"""simple docstring"""




import unittest

import torch
from torch import nn

from diffusers.models.activations import get_activation




class 			_a						(				unittest.TestCase    ):






    def     snake_case     (			self		:   Union[str, Any]							)     ->				Optional[int]:




          '''simple docstring'''



          _UpperCamelCase      : Dict         =   get_activation('''swish'''							)

          self.assertIsInstance(lowerCAmelCase__,			nn.SiLU							)

          self.assertEqual(act(torch.tensor(-1_0_0,			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(2_0,			dtype=torch.floataa							)							).item(),			2_0							)






    def     snake_case     (			self		:   List[Any]							)     ->				str:




          '''simple docstring'''



          _UpperCamelCase      : Optional[Any]         =   get_activation('''silu'''							)

          self.assertIsInstance(lowerCAmelCase__,			nn.SiLU							)

          self.assertEqual(act(torch.tensor(-1_0_0,			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(2_0,			dtype=torch.floataa							)							).item(),			2_0							)






    def     snake_case     (			self		:   Optional[int]							)     ->				str:




          '''simple docstring'''



          _UpperCamelCase      : Optional[Any]         =   get_activation('''mish'''							)

          self.assertIsInstance(lowerCAmelCase__,			nn.Mish							)

          self.assertEqual(act(torch.tensor(-2_0_0,			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(2_0,			dtype=torch.floataa							)							).item(),			2_0							)






    def     snake_case     (			self		:   int							)     ->				List[str]:




          '''simple docstring'''



          _UpperCamelCase      : Union[str, Any]         =   get_activation('''gelu'''							)

          self.assertIsInstance(lowerCAmelCase__,			nn.GELU							)

          self.assertEqual(act(torch.tensor(-1_0_0,			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(2_0,			dtype=torch.floataa							)							).item(),			2_0							)










"""simple docstring"""




import logging

from transformers.configuration_utils import PretrainedConfig


UpperCamelCase_									=logging.getLogger(__name__)




class 			_a						(				_lowerCAmelCase    ):
				UpperCamelCase								=   '''masked_bert'''






				def __init__(			self		:   Optional[Any],			lowerCAmelCase__		:   Dict=3_0_5_2_2,			lowerCAmelCase__		:   int=7_6_8,			lowerCAmelCase__		:   Tuple=1_2,			lowerCAmelCase__		:   Optional[Any]=1_2,			lowerCAmelCase__		:   Tuple=3_0_7_2,			lowerCAmelCase__		:   Optional[int]="gelu",			lowerCAmelCase__		:   Tuple=0.1,			lowerCAmelCase__		:   Tuple=0.1,			lowerCAmelCase__		:   Any=5_1_2,			lowerCAmelCase__		:   Optional[int]=2,			lowerCAmelCase__		:   Optional[int]=0.02,			lowerCAmelCase__		:   Union[str, Any]=1e-1_2,			lowerCAmelCase__		:   Union[str, Any]=0,			lowerCAmelCase__		:   Dict="topK",			lowerCAmelCase__		:   Union[str, Any]="constant",			lowerCAmelCase__		:   Union[str, Any]=0.0,			**lowerCAmelCase__		:   Any,			)     ->				List[Any]:




										'''simple docstring'''



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

										_UpperCamelCase      : Optional[Any]         =   vocab_size
										_UpperCamelCase      : int         =   hidden_size
										_UpperCamelCase      : List[Any]         =   num_hidden_layers
										_UpperCamelCase      : Any         =   num_attention_heads
										_UpperCamelCase      : List[str]         =   hidden_act
										_UpperCamelCase      : Tuple         =   intermediate_size
										_UpperCamelCase      : int         =   hidden_dropout_prob
										_UpperCamelCase      : str         =   attention_probs_dropout_prob
										_UpperCamelCase      : Optional[int]         =   max_position_embeddings
										_UpperCamelCase      : str         =   type_vocab_size
										_UpperCamelCase      : Optional[Any]         =   initializer_range
										_UpperCamelCase      : List[str]         =   layer_norm_eps
										_UpperCamelCase      : int         =   pruning_method
										_UpperCamelCase      : Union[str, Any]         =   mask_init
										_UpperCamelCase      : Any         =   mask_scale



