


import inspect

from diffusers.utils import is_flax_available
from diffusers.utils.testing_utils import require_flax


if is_flax_available():
  import jax







@require_flax
class 				__SCREAMING_SNAKE_CASE   :


      def        __lowerCamelCase			(							self		):
            lowercase   ,			lowercase			:   Any					   =		self.prepare_init_args_and_inputs_for_common()

            lowercase			:   Tuple					   =		self.model_class(**SCREAMING_SNAKE_CASE__		)
            lowercase			:   int					   =		model.init(inputs_dict['''prng_key''']							,						inputs_dict['''sample''']		)
            jax.lax.stop_gradient(SCREAMING_SNAKE_CASE__		)

            lowercase			:   List[Any]					   =		model.apply(SCREAMING_SNAKE_CASE__							,						inputs_dict['''sample''']		)

            if isinstance(SCREAMING_SNAKE_CASE__							,						SCREAMING_SNAKE_CASE__		):
                  lowercase			:   Optional[int]					   =		output.sample

            self.assertIsNotNone(SCREAMING_SNAKE_CASE__		)
            lowercase			:   Dict					   =		inputs_dict['''sample'''].shape
            self.assertEqual(output.shape							,						SCREAMING_SNAKE_CASE__							,						'''Input and output shapes do not match'''		)


      def        __lowerCamelCase			(							self		):
            lowercase   ,			lowercase			:   Optional[Any]					   =		self.prepare_init_args_and_inputs_for_common()

            lowercase			:   str					   =		16
            lowercase			:   str					   =		(16, 32)

            lowercase			:   List[str]					   =		self.model_class(**SCREAMING_SNAKE_CASE__		)
            lowercase			:   str					   =		model.init(inputs_dict['''prng_key''']							,						inputs_dict['''sample''']		)
            jax.lax.stop_gradient(SCREAMING_SNAKE_CASE__		)

            lowercase			:   Union[str, Any]					   =		model.apply(SCREAMING_SNAKE_CASE__							,						inputs_dict['''sample''']		)

            if isinstance(SCREAMING_SNAKE_CASE__							,						SCREAMING_SNAKE_CASE__		):
                  lowercase			:   Any					   =		output.sample

            self.assertIsNotNone(SCREAMING_SNAKE_CASE__		)
            lowercase			:   Optional[Any]					   =		inputs_dict['''sample'''].shape
            self.assertEqual(output.shape							,						SCREAMING_SNAKE_CASE__							,						'''Input and output shapes do not match'''		)






      def        __lowerCamelCase			(							self		):
            lowercase			:   List[str]					   =		'''kwargs''' in inspect.signature(self.model_class.__init__		).parameters
            lowercase			:   Optional[Any]					   =		len(self.model_class._deprecated_kwargs		) > 0

            if has_kwarg_in_model_class and not has_deprecated_kwarg:
                  raise ValueError(
                      f"""{self.model_class} has `**kwargs` in its __init__ method but has not defined any deprecated kwargs"""
                      ''' under the `_deprecated_kwargs` class attribute. Make sure to either remove `**kwargs` if there are'''
                      ''' no deprecated arguments or add the deprecated argument with `_deprecated_kwargs ='''
                      ''' [<deprecated_argument>]`'''		)

            if not has_kwarg_in_model_class and has_deprecated_kwarg:
                  raise ValueError(
                      f"""{self.model_class} doesn't have `**kwargs` in its __init__ method but has defined deprecated kwargs"""
                      ''' under the `_deprecated_kwargs` class attribute. Make sure to either add the `**kwargs` argument to'''
                      f""" {self.model_class}.__init__ if there are deprecated arguments or remove the deprecated argument"""
                      ''' from `_deprecated_kwargs = [<deprecated_argument>]`'''		)





from ...utils import (
    OptionalDependencyNotAvailable,
    is_torch_available,
    is_transformers_available,
    is_transformers_version,
)


try:
  if not (is_transformers_available() and is_torch_available() and is_transformers_version('''>=''', '''4.27.0''')):
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  from ...utils.dummy_torch_and_transformers_objects import (
      AudioLDMPipeline,
  )
else:
  from .pipeline_audioldm import AudioLDMPipeline

