
from collections import deque
from math import floor
from random import random
from time import time




class 					_lowerCamelCase			:





     """simple docstring"""







     def __init__(				self	)	-> Optional[int]:




           """simple docstring"""







           UpperCamelCase__     : Optional[int]											=					{}






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE=1	)	-> str:




           """simple docstring"""







           if self.graph.get(__SCREAMING_SNAKE_CASE	):
                 if self.graph[u].count([w, v]	) == 0:
                       self.graph[u].append([w, v]	)
           else:
                 UpperCamelCase__     : Optional[int]											=					[[w, v]]
           if not self.graph.get(__SCREAMING_SNAKE_CASE	):
                 UpperCamelCase__     : Optional[int]											=					[]






     def  __SCREAMING_SNAKE_CASE      (				self	)	-> List[str]:




           """simple docstring"""







           return list(self.graph	)






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE	)	-> Tuple:




           """simple docstring"""







           if self.graph.get(__SCREAMING_SNAKE_CASE	):
                 for _ in self.graph[u]:
                       if _[1] == v:
                             self.graph[u].remove(__SCREAMING_SNAKE_CASE	)






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE=-2    ,    __SCREAMING_SNAKE_CASE=-1	)	-> Tuple:




           """simple docstring"""







           if s == d:
                 return []
           UpperCamelCase__     : List[Any]											=					[]
           UpperCamelCase__     : Any											=					[]
           if s == -2:
                 UpperCamelCase__     : Tuple											=					list(self.graph	)[0]
           stack.append(__SCREAMING_SNAKE_CASE	)
           visited.append(__SCREAMING_SNAKE_CASE	)
           UpperCamelCase__     : List[Any]											=					s

           while True:
                 # check if there is any non isolated nodes
                 if len(self.graph[s]	) != 0:
                       UpperCamelCase__     : str											=					s
                       for node in self.graph[s]:
                             if visited.count(node[1]	) < 1:
                                   if node[1] == d:
                                         visited.append(__SCREAMING_SNAKE_CASE	)
                                         return visited
                                   else:
                                         stack.append(node[1]	)
                                         visited.append(node[1]	)
                                         UpperCamelCase__     : Optional[Any]											=					node[1]
                                         break

            # check if all the children are visited
                 if s == ss:
                       stack.pop()
                       if len(__SCREAMING_SNAKE_CASE	) != 0:
                             UpperCamelCase__     : str											=					stack[len(__SCREAMING_SNAKE_CASE	) - 1]
                 else:
                       UpperCamelCase__     : List[Any]											=					ss

                 # check if se have reached the starting point
                 if len(__SCREAMING_SNAKE_CASE	) == 0:
                       return visited






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE=-1	)	-> Union[str, Any]:




           """simple docstring"""







           if c == -1:
                 UpperCamelCase__     : Tuple											=					floor(random() * 1_0_0_0_0	) + 1_0
           for i in range(__SCREAMING_SNAKE_CASE	):
                 # every vertex has max 100 edges
                 for _ in range(floor(random() * 1_0_2	) + 1	):
                       UpperCamelCase__     : int											=					floor(random() * c	) + 1
                       if n != i:
                             self.add_pair(__SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    1	)






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE=-2	)	-> Dict:




           """simple docstring"""







           UpperCamelCase__     : List[Any]											=					deque()
           UpperCamelCase__     : int											=					[]
           if s == -2:
                 UpperCamelCase__     : Optional[int]											=					list(self.graph	)[0]
           d.append(__SCREAMING_SNAKE_CASE	)
           visited.append(__SCREAMING_SNAKE_CASE	)
           while d:
                 UpperCamelCase__     : Union[str, Any]											=					d.popleft()
                 if len(self.graph[s]	) != 0:
                       for node in self.graph[s]:
                             if visited.count(node[1]	) < 1:
                                   d.append(node[1]	)
                                   visited.append(node[1]	)
           return visited






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE	)	-> Dict:




           """simple docstring"""







           UpperCamelCase__     : Any											=					0
           for x in self.graph:
                 for y in self.graph[x]:
                       if y[1] == u:
                             count += 1
           return count






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE	)	-> int:




           """simple docstring"""







           return len(self.graph[u]	)






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE=-2	)	-> Tuple:




           """simple docstring"""







           UpperCamelCase__     : str											=					[]
           UpperCamelCase__     : List[str]											=					[]
           if s == -2:
                 UpperCamelCase__     : List[Any]											=					list(self.graph	)[0]
           stack.append(__SCREAMING_SNAKE_CASE	)
           visited.append(__SCREAMING_SNAKE_CASE	)
           UpperCamelCase__     : Optional[int]											=					s
           UpperCamelCase__     : List[str]											=					[]

           while True:
                 # check if there is any non isolated nodes
                 if len(self.graph[s]	) != 0:
                       UpperCamelCase__     : Optional[int]											=					s
                       for node in self.graph[s]:
                             if visited.count(node[1]	) < 1:
                                   stack.append(node[1]	)
                                   visited.append(node[1]	)
                                   UpperCamelCase__     : Optional[int]											=					node[1]
                                   break

            # check if all the children are visited
                 if s == ss:
                       sorted_nodes.append(stack.pop()	)
                       if len(__SCREAMING_SNAKE_CASE	) != 0:
                             UpperCamelCase__     : int											=					stack[len(__SCREAMING_SNAKE_CASE	) - 1]
                 else:
                       UpperCamelCase__     : Any											=					ss

                 # check if se have reached the starting point
                 if len(__SCREAMING_SNAKE_CASE	) == 0:
                       return sorted_nodes






     def  __SCREAMING_SNAKE_CASE      (				self	)	-> Optional[int]:




           """simple docstring"""







           UpperCamelCase__     : Union[str, Any]											=					[]
           UpperCamelCase__     : List[Any]											=					[]
           UpperCamelCase__     : Optional[Any]											=					list(self.graph	)[0]
           stack.append(__SCREAMING_SNAKE_CASE	)
           visited.append(__SCREAMING_SNAKE_CASE	)
           UpperCamelCase__     : Any											=					-2
           UpperCamelCase__     : int											=					[]
           UpperCamelCase__     : Union[str, Any]											=					s
           UpperCamelCase__     : Tuple											=					False
           UpperCamelCase__     : Union[str, Any]											=					set()

           while True:
                 # check if there is any non isolated nodes
                 if len(self.graph[s]	) != 0:
                       UpperCamelCase__     : Union[str, Any]											=					s
                       for node in self.graph[s]:
                             if (
                                 visited.count(node[1]	) > 0
                                 and node[1] != parent
                                 and indirect_parents.count(node[1]	) > 0
                                 and not on_the_way_back
                             ):
                                   UpperCamelCase__     : str											=					len(__SCREAMING_SNAKE_CASE	) - 1
                                   while len_stack >= 0:
                                         if stack[len_stack] == node[1]:
                                               anticipating_nodes.add(node[1]	)
                                               break
                                         else:
                                               anticipating_nodes.add(stack[len_stack]	)
                                               len_stack -= 1
                             if visited.count(node[1]	) < 1:
                                   stack.append(node[1]	)
                                   visited.append(node[1]	)
                                   UpperCamelCase__     : List[Any]											=					node[1]
                                   break

            # check if all the children are visited
                 if s == ss:
                       stack.pop()
                       UpperCamelCase__     : Tuple											=					True
                       if len(__SCREAMING_SNAKE_CASE	) != 0:
                             UpperCamelCase__     : Any											=					stack[len(__SCREAMING_SNAKE_CASE	) - 1]
                 else:
                       UpperCamelCase__     : List[str]											=					False
                       indirect_parents.append(__SCREAMING_SNAKE_CASE	)
                       UpperCamelCase__     : Any											=					s
                       UpperCamelCase__     : Any											=					ss

                 # check if se have reached the starting point
                 if len(__SCREAMING_SNAKE_CASE	) == 0:
                       return list(__SCREAMING_SNAKE_CASE	)






     def  __SCREAMING_SNAKE_CASE      (				self	)	-> Optional[Any]:




           """simple docstring"""







           UpperCamelCase__     : Union[str, Any]											=					[]
           UpperCamelCase__     : Optional[int]											=					[]
           UpperCamelCase__     : List[str]											=					list(self.graph	)[0]
           stack.append(__SCREAMING_SNAKE_CASE	)
           visited.append(__SCREAMING_SNAKE_CASE	)
           UpperCamelCase__     : Dict											=					-2
           UpperCamelCase__     : str											=					[]
           UpperCamelCase__     : Optional[int]											=					s
           UpperCamelCase__     : Tuple											=					False
           UpperCamelCase__     : Any											=					set()

           while True:
                 # check if there is any non isolated nodes
                 if len(self.graph[s]	) != 0:
                       UpperCamelCase__     : Dict											=					s
                       for node in self.graph[s]:
                             if (
                                 visited.count(node[1]	) > 0
                                 and node[1] != parent
                                 and indirect_parents.count(node[1]	) > 0
                                 and not on_the_way_back
                             ):
                                   UpperCamelCase__     : List[Any]											=					len(__SCREAMING_SNAKE_CASE	) - 1
                                   while len_stack_minus_one >= 0:
                                         if stack[len_stack_minus_one] == node[1]:
                                               anticipating_nodes.add(node[1]	)
                                               break
                                         else:
                                               return True
                             if visited.count(node[1]	) < 1:
                                   stack.append(node[1]	)
                                   visited.append(node[1]	)
                                   UpperCamelCase__     : Optional[Any]											=					node[1]
                                   break

            # check if all the children are visited
                 if s == ss:
                       stack.pop()
                       UpperCamelCase__     : Dict											=					True
                       if len(__SCREAMING_SNAKE_CASE	) != 0:
                             UpperCamelCase__     : Union[str, Any]											=					stack[len(__SCREAMING_SNAKE_CASE	) - 1]
                 else:
                       UpperCamelCase__     : Optional[Any]											=					False
                       indirect_parents.append(__SCREAMING_SNAKE_CASE	)
                       UpperCamelCase__     : str											=					s
                       UpperCamelCase__     : int											=					ss

                 # check if se have reached the starting point
                 if len(__SCREAMING_SNAKE_CASE	) == 0:
                       return False






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE=-2    ,    __SCREAMING_SNAKE_CASE=-1	)	-> Any:




           """simple docstring"""







           UpperCamelCase__     : Optional[int]											=					time()
           self.dfs(__SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE	)
           UpperCamelCase__     : Union[str, Any]											=					time()
           return end - begin






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE=-2	)	-> List[Any]:




           """simple docstring"""







           UpperCamelCase__     : str											=					time()
           self.bfs(__SCREAMING_SNAKE_CASE	)
           UpperCamelCase__     : Any											=					time()
           return end - begin




class 					_lowerCamelCase			:





     """simple docstring"""







     def __init__(				self	)	-> Dict:




           """simple docstring"""







           UpperCamelCase__     : Any											=					{}






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE=1	)	-> Any:




           """simple docstring"""







           if self.graph.get(__SCREAMING_SNAKE_CASE	):
                 # if there already is a edge
                 if self.graph[u].count([w, v]	) == 0:
                       self.graph[u].append([w, v]	)
           else:
                 # if u does not exist
                 UpperCamelCase__     : List[Any]											=					[[w, v]]
           # add the other way
           if self.graph.get(__SCREAMING_SNAKE_CASE	):
                 # if there already is a edge
                 if self.graph[v].count([w, u]	) == 0:
                       self.graph[v].append([w, u]	)
           else:
                 # if u does not exist
                 UpperCamelCase__     : Dict											=					[[w, u]]






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE	)	-> Any:




           """simple docstring"""







           if self.graph.get(__SCREAMING_SNAKE_CASE	):
                 for _ in self.graph[u]:
                       if _[1] == v:
                             self.graph[u].remove(__SCREAMING_SNAKE_CASE	)
        # the other way round
           if self.graph.get(__SCREAMING_SNAKE_CASE	):
                 for _ in self.graph[v]:
                       if _[1] == u:
                             self.graph[v].remove(__SCREAMING_SNAKE_CASE	)






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE=-2    ,    __SCREAMING_SNAKE_CASE=-1	)	-> int:




           """simple docstring"""







           if s == d:
                 return []
           UpperCamelCase__     : Optional[Any]											=					[]
           UpperCamelCase__     : int											=					[]
           if s == -2:
                 UpperCamelCase__     : int											=					list(self.graph	)[0]
           stack.append(__SCREAMING_SNAKE_CASE	)
           visited.append(__SCREAMING_SNAKE_CASE	)
           UpperCamelCase__     : Optional[Any]											=					s

           while True:
                 # check if there is any non isolated nodes
                 if len(self.graph[s]	) != 0:
                       UpperCamelCase__     : Any											=					s
                       for node in self.graph[s]:
                             if visited.count(node[1]	) < 1:
                                   if node[1] == d:
                                         visited.append(__SCREAMING_SNAKE_CASE	)
                                         return visited
                                   else:
                                         stack.append(node[1]	)
                                         visited.append(node[1]	)
                                         UpperCamelCase__     : Optional[Any]											=					node[1]
                                         break

            # check if all the children are visited
                 if s == ss:
                       stack.pop()
                       if len(__SCREAMING_SNAKE_CASE	) != 0:
                             UpperCamelCase__     : int											=					stack[len(__SCREAMING_SNAKE_CASE	) - 1]
                 else:
                       UpperCamelCase__     : str											=					ss

                 # check if se have reached the starting point
                 if len(__SCREAMING_SNAKE_CASE	) == 0:
                       return visited






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE=-1	)	-> Optional[Any]:




           """simple docstring"""







           if c == -1:
                 UpperCamelCase__     : Any											=					floor(random() * 1_0_0_0_0	) + 1_0
           for i in range(__SCREAMING_SNAKE_CASE	):
                 # every vertex has max 100 edges
                 for _ in range(floor(random() * 1_0_2	) + 1	):
                       UpperCamelCase__     : Dict											=					floor(random() * c	) + 1
                       if n != i:
                             self.add_pair(__SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    1	)






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE=-2	)	-> Union[str, Any]:




           """simple docstring"""







           UpperCamelCase__     : List[Any]											=					deque()
           UpperCamelCase__     : Any											=					[]
           if s == -2:
                 UpperCamelCase__     : List[str]											=					list(self.graph	)[0]
           d.append(__SCREAMING_SNAKE_CASE	)
           visited.append(__SCREAMING_SNAKE_CASE	)
           while d:
                 UpperCamelCase__     : str											=					d.popleft()
                 if len(self.graph[s]	) != 0:
                       for node in self.graph[s]:
                             if visited.count(node[1]	) < 1:
                                   d.append(node[1]	)
                                   visited.append(node[1]	)
           return visited






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE	)	-> int:




           """simple docstring"""







           return len(self.graph[u]	)






     def  __SCREAMING_SNAKE_CASE      (				self	)	-> Any:




           """simple docstring"""







           UpperCamelCase__     : Optional[Any]											=					[]
           UpperCamelCase__     : Any											=					[]
           UpperCamelCase__     : Optional[int]											=					list(self.graph	)[0]
           stack.append(__SCREAMING_SNAKE_CASE	)
           visited.append(__SCREAMING_SNAKE_CASE	)
           UpperCamelCase__     : List[str]											=					-2
           UpperCamelCase__     : Optional[int]											=					[]
           UpperCamelCase__     : Union[str, Any]											=					s
           UpperCamelCase__     : int											=					False
           UpperCamelCase__     : Tuple											=					set()

           while True:
                 # check if there is any non isolated nodes
                 if len(self.graph[s]	) != 0:
                       UpperCamelCase__     : int											=					s
                       for node in self.graph[s]:
                             if (
                                 visited.count(node[1]	) > 0
                                 and node[1] != parent
                                 and indirect_parents.count(node[1]	) > 0
                                 and not on_the_way_back
                             ):
                                   UpperCamelCase__     : int											=					len(__SCREAMING_SNAKE_CASE	) - 1
                                   while len_stack >= 0:
                                         if stack[len_stack] == node[1]:
                                               anticipating_nodes.add(node[1]	)
                                               break
                                         else:
                                               anticipating_nodes.add(stack[len_stack]	)
                                               len_stack -= 1
                             if visited.count(node[1]	) < 1:
                                   stack.append(node[1]	)
                                   visited.append(node[1]	)
                                   UpperCamelCase__     : int											=					node[1]
                                   break

            # check if all the children are visited
                 if s == ss:
                       stack.pop()
                       UpperCamelCase__     : str											=					True
                       if len(__SCREAMING_SNAKE_CASE	) != 0:
                             UpperCamelCase__     : List[str]											=					stack[len(__SCREAMING_SNAKE_CASE	) - 1]
                 else:
                       UpperCamelCase__     : List[Any]											=					False
                       indirect_parents.append(__SCREAMING_SNAKE_CASE	)
                       UpperCamelCase__     : Optional[int]											=					s
                       UpperCamelCase__     : Optional[int]											=					ss

                 # check if se have reached the starting point
                 if len(__SCREAMING_SNAKE_CASE	) == 0:
                       return list(__SCREAMING_SNAKE_CASE	)






     def  __SCREAMING_SNAKE_CASE      (				self	)	-> Optional[Any]:




           """simple docstring"""







           UpperCamelCase__     : int											=					[]
           UpperCamelCase__     : List[Any]											=					[]
           UpperCamelCase__     : Any											=					list(self.graph	)[0]
           stack.append(__SCREAMING_SNAKE_CASE	)
           visited.append(__SCREAMING_SNAKE_CASE	)
           UpperCamelCase__     : Optional[Any]											=					-2
           UpperCamelCase__     : Union[str, Any]											=					[]
           UpperCamelCase__     : List[Any]											=					s
           UpperCamelCase__     : str											=					False
           UpperCamelCase__     : Dict											=					set()

           while True:
                 # check if there is any non isolated nodes
                 if len(self.graph[s]	) != 0:
                       UpperCamelCase__     : List[Any]											=					s
                       for node in self.graph[s]:
                             if (
                                 visited.count(node[1]	) > 0
                                 and node[1] != parent
                                 and indirect_parents.count(node[1]	) > 0
                                 and not on_the_way_back
                             ):
                                   UpperCamelCase__     : Any											=					len(__SCREAMING_SNAKE_CASE	) - 1
                                   while len_stack_minus_one >= 0:
                                         if stack[len_stack_minus_one] == node[1]:
                                               anticipating_nodes.add(node[1]	)
                                               break
                                         else:
                                               return True
                             if visited.count(node[1]	) < 1:
                                   stack.append(node[1]	)
                                   visited.append(node[1]	)
                                   UpperCamelCase__     : Any											=					node[1]
                                   break

            # check if all the children are visited
                 if s == ss:
                       stack.pop()
                       UpperCamelCase__     : Dict											=					True
                       if len(__SCREAMING_SNAKE_CASE	) != 0:
                             UpperCamelCase__     : Dict											=					stack[len(__SCREAMING_SNAKE_CASE	) - 1]
                 else:
                       UpperCamelCase__     : Optional[int]											=					False
                       indirect_parents.append(__SCREAMING_SNAKE_CASE	)
                       UpperCamelCase__     : Union[str, Any]											=					s
                       UpperCamelCase__     : List[Any]											=					ss

                 # check if se have reached the starting point
                 if len(__SCREAMING_SNAKE_CASE	) == 0:
                       return False






     def  __SCREAMING_SNAKE_CASE      (				self	)	-> List[str]:




           """simple docstring"""







           return list(self.graph	)






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE=-2    ,    __SCREAMING_SNAKE_CASE=-1	)	-> List[str]:




           """simple docstring"""







           UpperCamelCase__     : Tuple											=					time()
           self.dfs(__SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE	)
           UpperCamelCase__     : Optional[Any]											=					time()
           return end - begin






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE=-2	)	-> List[Any]:




           """simple docstring"""







           UpperCamelCase__     : List[str]											=					time()
           self.bfs(__SCREAMING_SNAKE_CASE	)
           UpperCamelCase__     : Union[str, Any]											=					time()
           return end - begin




import gc
import unittest

import numpy as np
import torch

from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel
from diffusers.utils import slow, torch_device
from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, skip_mps

from ..pipeline_params import UNCONDITIONAL_AUDIO_GENERATION_BATCH_PARAMS, UNCONDITIONAL_AUDIO_GENERATION_PARAMS
from ..test_pipelines_common import PipelineTesterMixin


enable_full_determinism()




class 					_lowerCamelCase			(   UpperCamelCase_						,				unittest.TestCase			):





     """simple docstring"""







     SCREAMING_SNAKE_CASE_		 =	DanceDiffusionPipeline
     SCREAMING_SNAKE_CASE_		 =	UNCONDITIONAL_AUDIO_GENERATION_PARAMS
     SCREAMING_SNAKE_CASE_		 =	PipelineTesterMixin.required_optional_params - {
         '''callback''',
         '''latents''',
         '''callback_steps''',
         '''output_type''',
         '''num_images_per_prompt''',
     }
     SCREAMING_SNAKE_CASE_		 =	UNCONDITIONAL_AUDIO_GENERATION_BATCH_PARAMS
     SCREAMING_SNAKE_CASE_		 =	False
     SCREAMING_SNAKE_CASE_		 =	False






     def  __SCREAMING_SNAKE_CASE      (				self	)	-> Any:




           """simple docstring"""







           torch.manual_seed(0	)
           UpperCamelCase__     : List[str]											=					UNetaDModel(
               block_out_channels=(3_2, 3_2, 6_4)    ,    extra_in_channels=1_6    ,    sample_size=5_1_2    ,    sample_rate=1_6_0_0_0    ,    in_channels=2    ,    out_channels=2    ,    flip_sin_to_cos=__SCREAMING_SNAKE_CASE    ,    use_timestep_embedding=__SCREAMING_SNAKE_CASE    ,    time_embedding_type='''fourier'''    ,    mid_block_type='''UNetMidBlock1D'''    ,    down_block_types=('''DownBlock1DNoSkip''', '''DownBlock1D''', '''AttnDownBlock1D''')    ,    up_block_types=('''AttnUpBlock1D''', '''UpBlock1D''', '''UpBlock1DNoSkip''')    ,    )
           UpperCamelCase__     : Union[str, Any]											=					IPNDMScheduler()

           UpperCamelCase__     : List[str]											=					{
               '''unet''': unet,
               '''scheduler''': scheduler,
           }
           return components






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE=0	)	-> Any:




           """simple docstring"""







           if str(__SCREAMING_SNAKE_CASE	).startswith('''mps'''	):
                 UpperCamelCase__     : Optional[Any]											=					torch.manual_seed(__SCREAMING_SNAKE_CASE	)
           else:
                 UpperCamelCase__     : Optional[Any]											=					torch.Generator(device=__SCREAMING_SNAKE_CASE	).manual_seed(__SCREAMING_SNAKE_CASE	)
           UpperCamelCase__     : int											=					{
               '''batch_size''': 1,
               '''generator''': generator,
               '''num_inference_steps''': 4,
           }
           return inputs






     def  __SCREAMING_SNAKE_CASE      (				self	)	-> List[Any]:




           """simple docstring"""







           UpperCamelCase__     : str											=					'''cpu'''  # ensure determinism for the device-dependent torch.Generator
           UpperCamelCase__     : Dict											=					self.get_dummy_components()
           UpperCamelCase__     : str											=					DanceDiffusionPipeline(**__SCREAMING_SNAKE_CASE	)
           UpperCamelCase__     : List[Any]											=					pipe.to(__SCREAMING_SNAKE_CASE	)
           pipe.set_progress_bar_config(disable=__SCREAMING_SNAKE_CASE	)

           UpperCamelCase__     : int											=					self.get_dummy_inputs(__SCREAMING_SNAKE_CASE	)
           UpperCamelCase__     : Dict											=					pipe(**__SCREAMING_SNAKE_CASE	)
           UpperCamelCase__     : List[str]											=					output.audios

           UpperCamelCase__     : Dict											=					audio[0, -3:, -3:]

           assert audio.shape == (1, 2, components["unet"].sample_size)
           UpperCamelCase__     : List[Any]											=					np.array([-0.7265, 1.0000, -0.8388, 0.1175, 0.9498, -1.0000]	)
           assert np.abs(audio_slice.flatten() - expected_slice	).max() < 1e-2






     @skip_mps
     def  __SCREAMING_SNAKE_CASE      (				self	)	-> List[Any]:




           """simple docstring"""







           return super().test_save_load_local()






     @skip_mps
     def  __SCREAMING_SNAKE_CASE      (				self	)	-> Tuple:




           """simple docstring"""







           return super().test_dict_tuple_outputs_equivalent(expected_max_difference=3e-3	)






     @skip_mps
     def  __SCREAMING_SNAKE_CASE      (				self	)	-> str:




           """simple docstring"""







           return super().test_save_load_optional_components()






     @skip_mps
     def  __SCREAMING_SNAKE_CASE      (				self	)	-> Optional[int]:




           """simple docstring"""







           return super().test_attention_slicing_forward_pass()






     def  __SCREAMING_SNAKE_CASE      (				self	)	-> Tuple:




           """simple docstring"""







           super().test_inference_batch_single_identical(expected_max_diff=3e-3	)




@slow
@require_torch_gpu
class 					_lowerCamelCase			(   unittest.TestCase			):





     """simple docstring"""







     def  __SCREAMING_SNAKE_CASE      (				self	)	-> int:




           """simple docstring"""







           super().tearDown()
           gc.collect()
           torch.cuda.empty_cache()






     def  __SCREAMING_SNAKE_CASE      (				self	)	-> Union[str, Any]:




           """simple docstring"""







           UpperCamelCase__     : Any											=					torch_device

           UpperCamelCase__     : Any											=					DanceDiffusionPipeline.from_pretrained('''harmonai/maestro-150k'''	)
           UpperCamelCase__     : int											=					pipe.to(__SCREAMING_SNAKE_CASE	)
           pipe.set_progress_bar_config(disable=__SCREAMING_SNAKE_CASE	)

           UpperCamelCase__     : int											=					torch.manual_seed(0	)
           UpperCamelCase__     : Optional[Any]											=					pipe(generator=__SCREAMING_SNAKE_CASE    ,    num_inference_steps=1_0_0    ,    audio_length_in_s=4.096	)
           UpperCamelCase__     : str											=					output.audios

           UpperCamelCase__     : List[Any]											=					audio[0, -3:, -3:]

           assert audio.shape == (1, 2, pipe.unet.sample_size)
           UpperCamelCase__     : Tuple											=					np.array([-0.0192, -0.0231, -0.0318, -0.0059, 0.0002, -0.0020]	)

           assert np.abs(audio_slice.flatten() - expected_slice	).max() < 1e-2






     def  __SCREAMING_SNAKE_CASE      (				self	)	-> Union[str, Any]:




           """simple docstring"""







           UpperCamelCase__     : Any											=					torch_device

           UpperCamelCase__     : Union[str, Any]											=					DanceDiffusionPipeline.from_pretrained('''harmonai/maestro-150k'''    ,    torch_dtype=torch.floataa	)
           UpperCamelCase__     : Tuple											=					pipe.to(__SCREAMING_SNAKE_CASE	)
           pipe.set_progress_bar_config(disable=__SCREAMING_SNAKE_CASE	)

           UpperCamelCase__     : int											=					torch.manual_seed(0	)
           UpperCamelCase__     : Union[str, Any]											=					pipe(generator=__SCREAMING_SNAKE_CASE    ,    num_inference_steps=1_0_0    ,    audio_length_in_s=4.096	)
           UpperCamelCase__     : List[Any]											=					output.audios

           UpperCamelCase__     : List[Any]											=					audio[0, -3:, -3:]

           assert audio.shape == (1, 2, pipe.unet.sample_size)
           UpperCamelCase__     : Optional[Any]											=					np.array([-0.0367, -0.0488, -0.0771, -0.0525, -0.0444, -0.0341]	)

           assert np.abs(audio_slice.flatten() - expected_slice	).max() < 1e-2


