



from ...configuration_utils import PretrainedConfig





class  __magic_name__   (							A__						):
		lowercase      :       int          ='''bert-generation'''






		def __init__(						self      :     Any				,		UpperCamelCase__      :     str=5_03_58				,		UpperCamelCase__      :     str=10_24				,		UpperCamelCase__      :     List[str]=24				,		UpperCamelCase__      :     int=16				,		UpperCamelCase__      :     List[Any]=40_96				,		UpperCamelCase__      :     Optional[Any]="gelu"				,		UpperCamelCase__      :     Optional[int]=0.1				,		UpperCamelCase__      :     Dict=0.1				,		UpperCamelCase__      :     Tuple=5_12				,		UpperCamelCase__      :     List[str]=0.02				,		UpperCamelCase__      :     Dict=1e-1_2				,		UpperCamelCase__      :     Tuple=0				,		UpperCamelCase__      :     Tuple=2				,		UpperCamelCase__      :     str=1				,		UpperCamelCase__      :     Tuple="absolute"				,		UpperCamelCase__      :     Union[str, Any]=True				,		**UpperCamelCase__      :     int				,		)				->					Any:
								'''simple docstring'''







								super().__init__(pad_token_id=UpperCamelCase__				,		bos_token_id=UpperCamelCase__				,		eos_token_id=UpperCamelCase__				,		**UpperCamelCase__      )

								UpperCAmelCase         =     vocab_size
								UpperCAmelCase         =     hidden_size
								UpperCAmelCase         =     num_hidden_layers
								UpperCAmelCase         =     num_attention_heads
								UpperCAmelCase         =     hidden_act
								UpperCAmelCase         =     intermediate_size
								UpperCAmelCase         =     hidden_dropout_prob
								UpperCAmelCase         =     attention_probs_dropout_prob
								UpperCAmelCase         =     max_position_embeddings
								UpperCAmelCase         =     initializer_range
								UpperCAmelCase         =     layer_norm_eps
								UpperCAmelCase         =     position_embedding_type
								UpperCAmelCase         =     use_cache








import unittest

import torch
from torch import nn

from diffusers.models.activations import get_activation





class  __magic_name__   (							unittest.TestCase						):






		def SCREAMING_SNAKE_CASE_			(						self      :     int      )				->					str:
								'''simple docstring'''







								UpperCAmelCase         =     get_activation("swish"      )

								self.assertIsInstance(UpperCamelCase__				,		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 SCREAMING_SNAKE_CASE_			(						self      :     Tuple      )				->					List[Any]:
								'''simple docstring'''







								UpperCAmelCase         =     get_activation("silu"      )

								self.assertIsInstance(UpperCamelCase__				,		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 SCREAMING_SNAKE_CASE_			(						self      :     Optional[Any]      )				->					int:
								'''simple docstring'''







								UpperCAmelCase         =     get_activation("mish"      )

								self.assertIsInstance(UpperCamelCase__				,		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 SCREAMING_SNAKE_CASE_			(						self      :     str      )				->					List[str]:
								'''simple docstring'''







								UpperCAmelCase         =     get_activation("gelu"      )

								self.assertIsInstance(UpperCamelCase__				,		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      )



