


'''simple docstring'''


import unittest

import torch

from diffusers import DDIMScheduler, TextToVideoZeroPipeline
from diffusers.utils import load_pt, require_torch_gpu, slow

from ..test_pipelines_common import assert_mean_pixel_difference





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





	'''simple docstring'''


	def UpperCAmelCase_			(					self						):
					_SCREAMING_SNAKE_CASE				: List[Any]  	=   """runwayml/stable-diffusion-v1-5"""
					_SCREAMING_SNAKE_CASE				: List[str]  	=   TextToVideoZeroPipeline.from_pretrained(__A					,      torch_dtype=torch.floataa						).to("""cuda"""						)
					_SCREAMING_SNAKE_CASE				: Optional[int]  	=   DDIMScheduler.from_config(pipe.scheduler.config						)
					_SCREAMING_SNAKE_CASE				: Any  	=   torch.Generator(device="""cuda"""						).manual_seed(0						)

					_SCREAMING_SNAKE_CASE				: Union[str, Any]  	=   """A bear is playing a guitar on Times Square"""
					_SCREAMING_SNAKE_CASE				: Union[str, Any]  	=   pipe(prompt=__A					,      generator=__A						).images

					_SCREAMING_SNAKE_CASE				: str  	=   load_pt(
					    """https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/text-to-video/A bear is playing a guitar on Times Square.pt"""						)

					assert_mean_pixel_difference(__A					,      __A						)








'''simple docstring'''


from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


UpperCAmelCase_	:     Any							     =	{
    'configuration_musicgen': [
        'MUSICGEN_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'MusicgenConfig',
        'MusicgenDecoderConfig',
    ],
    'processing_musicgen': ['MusicgenProcessor'],
}

try:
				if not is_torch_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				UpperCAmelCase_	:     Any							     =	[
				    'MUSICGEN_PRETRAINED_MODEL_ARCHIVE_LIST',
				    'MusicgenForConditionalGeneration',
				    'MusicgenForCausalLM',
				    'MusicgenModel',
				    'MusicgenPreTrainedModel',
				]

if TYPE_CHECKING:
				from .configuration_musicgen import (
				    MUSICGEN_PRETRAINED_CONFIG_ARCHIVE_MAP,
				    MusicgenConfig,
				    MusicgenDecoderConfig,
				)
				from .processing_musicgen import MusicgenProcessor

				try:
								if not is_torch_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_musicgen import (
								    MUSICGEN_PRETRAINED_MODEL_ARCHIVE_LIST,
								    MusicgenForCausalLM,
								    MusicgenForConditionalGeneration,
								    MusicgenModel,
								    MusicgenPreTrainedModel,
								)

else:
				import sys

				UpperCAmelCase_	:     Tuple							     =	_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)




