



"""simple docstring"""


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 				A_      (					unittest.TestCase     ,       SCREAMING_SNAKE_CASE_    ):



      """simple docstring"""






      def      UpperCAmelCase__					( self			:Dict )    ->      Any:
            UpperCAmelCase					=			load_tool('text-to-speech' )
            self.tool.setup()






      def      UpperCAmelCase__					( self			:List[str] )    ->      Tuple:
            # SpeechT5 isn't deterministic
            torch.manual_seed(0 )
            UpperCAmelCase					=			self.tool('hey' )
            UpperCAmelCase					=			result.to_raw()
            self.assertTrue(
                torch.allclose(
                    resulting_tensor[:3]       ,  torch.tensor([-0.000_5966_6688_3211_5829, -0.000_3657_6401_9079_5064, -0.0001_3439_5027_9988_3485] )       ,  ) )






      def      UpperCAmelCase__					( self			:Optional[int] )    ->      Any:
            # SpeechT5 isn't deterministic
            torch.manual_seed(0 )
            UpperCAmelCase					=			self.tool('hey' )
            UpperCAmelCase					=			result.to_raw()
            self.assertTrue(
                torch.allclose(
                    resulting_tensor[:3]       ,  torch.tensor([-0.000_5966_6688_3211_5829, -0.000_3657_6401_9079_5064, -0.0001_3439_5027_9988_3485] )       ,  ) )










"""simple docstring"""


import math

def 			_lowerCAmelCase				(       lowercase_						):
						assert isinstance(lowercase_		,     lowercase_						) and (
						    number >= 0
						), "'number' must been an int and positive"

						if 1 < number < 4:
												# 2 and 3 are primes
												return True
						elif number < 2 or not number % 2:
												# Negatives, 0, 1 and all even numbers are not primes
												return False

						UpperCAmelCase					=			range(3		,     int(math.sqrt(lowercase_						) + 1						)		,     2						)
						return not any(not number % i for i in odd_numbers						)






def 			_lowerCAmelCase				(       lowercase_		,     lowercase_=1		,     **lowercase_						):
						UpperCAmelCase					=			factor * value
						UpperCAmelCase					=			value

						while not is_prime(lowercase_						):
												value += 1 if not ("desc" in kwargs and kwargs["desc"] is True) else -1

						if value == first_value_val:
												return next_prime(value + 1		,     **lowercase_						)
						return value





