
import unittest

from transformers import load_tool
from transformers.utils import is_torch_available


if is_torch_available():
 import torch

from transformers.testing_utils import require_torch

from .test_tools_common import ToolTesterMixin


@require_torch
class   __lowerCAmelCase		(		unittest.TestCase       ,       lowerCAmelCase_					):



      """simple docstring"""







      def 						snake_case_	(					self						:				Tuple ):
          __lowercase						:	Union[str, Any]					=				load_tool('''text-to-speech''' )
          self.tool.setup()




      def 						snake_case_	(					self						:				Union[str, Any] ):
          torch.manual_seed(0 )
          __lowercase						:	List[Any]					=				self.tool('''hey''' )
          __lowercase						:	Optional[int]					=				result.to_raw()
          self.assertTrue(
              torch.allclose(
                  resulting_tensor[:3] ,				torch.tensor([-0.0_00_59_66_66_88_32_11_58_29, -0.0_00_36_57_64_01_90_79_50_64, -0.00_01_34_39_50_27_99_88_34_85] ) ,				) )




      def 						snake_case_	(					self						:				Dict ):
          torch.manual_seed(0 )
          __lowercase						:	Optional[int]					=				self.tool('''hey''' )
          __lowercase						:	Optional[int]					=				result.to_raw()
          self.assertTrue(
              torch.allclose(
                  resulting_tensor[:3] ,				torch.tensor([-0.0_00_59_66_66_88_32_11_58_29, -0.0_00_36_57_64_01_90_79_50_64, -0.00_01_34_39_50_27_99_88_34_85] ) ,				) )









from argparse import ArgumentParser

from .env import EnvironmentCommand



def    __lowercase   (      ) ->   Dict:


      '''simple docstring'''


      SCREAMING_SNAKE_CASE		=						ArgumentParser("""Diffusers CLI tool""" ,						usage="""diffusers-cli <command> [<args>]"""	)
      SCREAMING_SNAKE_CASE		=						parser.add_subparsers(help="""diffusers-cli command helpers"""	)

      # Register commands
      EnvironmentCommand.register_subcommand(_SCREAMING_SNAKE_CASE	)

      # Let's go
      SCREAMING_SNAKE_CASE		=						parser.parse_args()

      if not hasattr(_SCREAMING_SNAKE_CASE ,						"""func"""	):
            parser.print_help()
            exit(1	)

      # Run
      SCREAMING_SNAKE_CASE		=						args.func(_SCREAMING_SNAKE_CASE	)
      service.run()


if __name__ == "__main__":
      main()


