




import unittest

import numpy as np

from transformers import is_tf_available
from transformers.testing_utils import require_tf


if is_tf_available():
 import tensorflow as tf

 from transformers.activations_tf import get_tf_activation



@require_tf
class     a  (     unittest.TestCase    ):

     '''simple docstring'''





     def 						lowerCamelCase_     (			self     :    Optional[Any]       ):
         UpperCAmelCase_											=  tf.constant([-1_00, -1.0, -0.1, 0, 0.1, 1.0, 100.0]       )
         UpperCAmelCase_											=  get_tf_activation('''gelu'''       )
         UpperCAmelCase_											=  get_tf_activation('''gelu_10'''       )

         UpperCAmelCase_											=  gelu(__snake_case       )
         UpperCAmelCase_											=  geluaa(__snake_case       )

         UpperCAmelCase_											=  tf.where(y_gelu_aa < 10.0      ,					1.0      ,					0.0       )

         self.assertEqual(tf.math.reduce_max(__snake_case       ).numpy().item()      ,					10.0       )
         self.assertTrue(np.allclose(y_gelu * clipped_mask      ,					y_gelu_aa * clipped_mask       )       )




     def 						lowerCamelCase_     (			self     :    Optional[int]       ):
         get_tf_activation('''gelu'''       )
         get_tf_activation('''gelu_10'''       )
         get_tf_activation('''gelu_fast'''       )
         get_tf_activation('''gelu_new'''       )
         get_tf_activation('''glu'''       )
         get_tf_activation('''mish'''       )
         get_tf_activation('''quick_gelu'''       )
         get_tf_activation('''relu'''       )
         get_tf_activation('''sigmoid'''       )
         get_tf_activation('''silu'''       )
         get_tf_activation('''swish'''       )
         get_tf_activation('''tanh'''       )
         with self.assertRaises(__snake_case       ):
             get_tf_activation('''bogus'''       )
         with self.assertRaises(__snake_case       ):
             get_tf_activation(__snake_case       )











import unittest
from pathlib import Path
from tempfile import TemporaryDirectory
from unittest.mock import Mock, patch

import diffusers.utils.hub_utils



class     a  (     unittest.TestCase    ):

     '''simple docstring'''





     @patch('''diffusers.utils.hub_utils.get_full_repo_name'''       )
     def 						lowerCamelCase_     (			self     :    List[Any]      ,					__snake_case     :    Mock       ):
         UpperCAmelCase_											=  '''full_repo_name'''
         with TemporaryDirectory() as tmpdir:
             # Dummy args values
             UpperCAmelCase_											=  Mock()
             UpperCAmelCase_											=  tmpdir
             UpperCAmelCase_											=  0
             UpperCAmelCase_											=  '''hub_token'''
             UpperCAmelCase_											=  '''dataset_name'''
             UpperCAmelCase_											=  0.01
             UpperCAmelCase_											=  10_00_00
             UpperCAmelCase_											=  1_00_00
             UpperCAmelCase_											=  0.01
             UpperCAmelCase_											=  0.02
             UpperCAmelCase_											=  0.03
             UpperCAmelCase_											=  0.0_005
             UpperCAmelCase_											=  0.000_001
             UpperCAmelCase_											=  1
             UpperCAmelCase_											=  10
             UpperCAmelCase_											=  0.001
             UpperCAmelCase_											=  0.1
             UpperCAmelCase_											=  0.2
             UpperCAmelCase_											=  True

             # Model card mush be rendered and saved
             diffusers.utils.hub_utils.create_model_card(__snake_case      ,					model_name='''model_name'''       )
             self.assertTrue((Path(__snake_case       ) / '''README.md''').is_file()       )





