


import unittest

import numpy as np
import torch

from diffusers import VersatileDiffusionImageVariationPipeline
from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device


a					  =     False







class        UpperCamelCase__   (	unittest.TestCase   ):
					pass







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

					def   UpperCAmelCase__       (     self       :   str       ):






										'''simple docstring'''






										lowercase_  							=			VersatileDiffusionImageVariationPipeline.from_pretrained("""shi-labs/versatile-diffusion"""       )
										pipe.to(UpperCamelCase__       )
										pipe.set_progress_bar_config(disable=UpperCamelCase__       )

										lowercase_  							=			load_image(
										    """https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/versatile_diffusion/benz.jpg"""       )
										lowercase_  							=			torch.manual_seed(0       )
										lowercase_  							=			pipe(
										    image=UpperCamelCase__							,					generator=UpperCamelCase__							,					guidance_scale=7.5							,					num_inference_steps=50							,					output_type="""numpy"""							,					).images

										lowercase_  							=			image[0, 253:256, 253:256, -1]

										assert image.shape == (1, 512, 512, 3)
										lowercase_  							=			np.array([0.0_441, 0.0_469, 0.0_507, 0.0_575, 0.0_632, 0.0_650, 0.0_865, 0.0_909, 0.0_945]       )

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






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


try:
							if not (is_transformers_available() and is_torch_available()):
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							from ...utils.dummy_torch_and_transformers_objects import *  # noqa F403
else:
							from .multicontrolnet import MultiControlNetModel
							from .pipeline_controlnet import StableDiffusionControlNetPipeline
							from .pipeline_controlnet_imgaimg import StableDiffusionControlNetImgaImgPipeline
							from .pipeline_controlnet_inpaint import StableDiffusionControlNetInpaintPipeline


if is_transformers_available() and is_flax_available():
							from .pipeline_flax_controlnet import FlaxStableDiffusionControlNetPipeline


