




'''simple docstring'''







import unittest

import torch
from torch import nn

from diffusers.models.activations import get_activation


class 			_a  (	unittest.TestCase ):
       def     A      (	self						:	List[str]				):



           '''simple docstring'''

           UpperCAmelCase			       =		get_activation('''swish'''				)

           self.assertIsInstance(lowercase   ,				nn.SiLU				)

           self.assertEqual(act(torch.tensor(-100   ,				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     A      (	self						:	List[str]				):



           '''simple docstring'''

           UpperCAmelCase			       =		get_activation('''silu'''				)

           self.assertIsInstance(lowercase   ,				nn.SiLU				)

           self.assertEqual(act(torch.tensor(-100   ,				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     A      (	self						:	List[Any]				):



           '''simple docstring'''

           UpperCAmelCase			       =		get_activation('''mish'''				)

           self.assertIsInstance(lowercase   ,				nn.Mish				)

           self.assertEqual(act(torch.tensor(-200   ,				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     A      (	self						:	Union[str, Any]				):



           '''simple docstring'''

           UpperCAmelCase			       =		get_activation('''gelu'''				)

           self.assertIsInstance(lowercase   ,				nn.GELU				)

           self.assertEqual(act(torch.tensor(-100   ,				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				)










'''simple docstring'''







from argparse import ArgumentParser

from datasets.commands.convert import ConvertCommand
from datasets.commands.dummy_data import DummyDataCommand
from datasets.commands.env import EnvironmentCommand
from datasets.commands.run_beam import RunBeamCommand
from datasets.commands.test import TestCommand
from datasets.utils.logging import set_verbosity_info





def 						snake_case_							(_a	:							Tuple     ):
    return {key.lstrip('''-'''     ): value for key, value in zip(unknown_args[::2]    ,   unknown_args[1::2]     )}





def 						snake_case_							():
    UpperCAmelCase			       =		ArgumentParser(
        '''HuggingFace Datasets CLI tool'''    ,   usage='''datasets-cli <command> [<args>]'''    ,   allow_abbrev=_a     )
    UpperCAmelCase			       =		parser.add_subparsers(help='''datasets-cli command helpers'''     )
    set_verbosity_info()

    # Register commands
    ConvertCommand.register_subcommand(_a     )
    EnvironmentCommand.register_subcommand(_a     )
    TestCommand.register_subcommand(_a     )
    RunBeamCommand.register_subcommand(_a     )
    DummyDataCommand.register_subcommand(_a     )

    # Parse args
    UpperCAmelCase       ,     UpperCAmelCase			       =		parser.parse_known_args()
    if not hasattr(_a    ,   '''func'''     ):
        parser.print_help()
        exit(1     )
    UpperCAmelCase			       =		parse_unknown_args(_a     )

    # Run
    UpperCAmelCase			       =		args.func(_a    ,   **_a     )
    service.run()


if __name__ == "__main__":
   main()




