


'''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      UpperCAmelCase_						(unittest.TestCase						):





    """simple docstring"""






    def    lowercase_       (							self			)       ->  Optional[int]:
         __lowerCamelCase     :			List[Any]              =	'runwayml/stable-diffusion-v1-5'
         __lowerCamelCase     :			Union[str, Any]              =	TextToVideoZeroPipeline.from_pretrained(SCREAMING_SNAKE_CASE_    ,  torch_dtype=torch.floataa			).to('cuda'			)
         __lowerCamelCase     :			Dict              =	DDIMScheduler.from_config(pipe.scheduler.config			)
         __lowerCamelCase     :			Any              =	torch.Generator(device='cuda'			).manual_seed(0			)

         __lowerCamelCase     :			Union[str, Any]              =	'A bear is playing a guitar on Times Square'
         __lowerCamelCase     :			List[Any]              =	pipe(prompt=SCREAMING_SNAKE_CASE_    ,  generator=SCREAMING_SNAKE_CASE_			).images

         __lowerCamelCase     :			List[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(SCREAMING_SNAKE_CASE_    ,  SCREAMING_SNAKE_CASE_			)










'''simple docstring'''



from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_torch_available


A__	:      Optional[Any]				=						{
    """configuration_xlm_prophetnet""": ["""XLM_PROPHETNET_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMProphetNetConfig"""],
}

try:
      if not is_sentencepiece_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      A__	:      List[Any]				=						["""XLMProphetNetTokenizer"""]

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      A__	:      Optional[Any]				=						[
          """XLM_PROPHETNET_PRETRAINED_MODEL_ARCHIVE_LIST""",
          """XLMProphetNetDecoder""",
          """XLMProphetNetEncoder""",
          """XLMProphetNetForCausalLM""",
          """XLMProphetNetForConditionalGeneration""",
          """XLMProphetNetModel""",
          """XLMProphetNetPreTrainedModel""",
      ]


if TYPE_CHECKING:
      from .configuration_xlm_prophetnet import XLM_PROPHETNET_PRETRAINED_CONFIG_ARCHIVE_MAP, XLMProphetNetConfig

      try:
            if not is_sentencepiece_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .tokenization_xlm_prophetnet import XLMProphetNetTokenizer

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_xlm_prophetnet import (
                XLM_PROPHETNET_PRETRAINED_MODEL_ARCHIVE_LIST,
                XLMProphetNetDecoder,
                XLMProphetNetEncoder,
                XLMProphetNetForCausalLM,
                XLMProphetNetForConditionalGeneration,
                XLMProphetNetModel,
                XLMProphetNetPreTrainedModel,
            )

else:
      import sys

      A__	:      List[str]				=						_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)






