





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

			'''simple docstring'''







			pass






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

			'''simple docstring'''







			def 	__lowerCamelCase       (					self							):



				'''simple docstring'''







				lowerCamelCase__              =	VersatileDiffusionImageVariationPipeline.from_pretrained('''shi-labs/versatile-diffusion'''							)
				pipe.to(__lowerCAmelCase							)
				pipe.set_progress_bar_config(disable=__lowerCAmelCase							)

				lowerCamelCase__              =	load_image(
				    '''https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/versatile_diffusion/benz.jpg'''							)
				lowerCamelCase__              =	torch.manual_seed(0							)
				lowerCamelCase__              =	pipe(
				    image=__lowerCAmelCase ,						generator=__lowerCAmelCase ,						guidance_scale=7.5 ,						num_inference_steps=5_0 ,						output_type='''numpy''' ,						).images

				lowerCamelCase__              =	image[0, 2_5_3:2_5_6, 2_5_3:2_5_6, -1]

				assert image.shape == (1, 5_1_2, 5_1_2, 3)
				lowerCamelCase__              =	np.array([0.0441, 0.0469, 0.0507, 0.0575, 0.0632, 0.0650, 0.0865, 0.0909, 0.0945]							)

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










# This is the module that test_patching.py uses to test patch_submodule()

import os  # noqa: this is just for tests
import os as renamed_os  # noqa: this is just for tests
from os import path  # noqa: this is just for tests
from os import path as renamed_path  # noqa: this is just for tests
from os.path import join  # noqa: this is just for tests
from os.path import join as renamed_join  # noqa: this is just for tests


_a						=   open  # noqa: we just need to have a builtin inside this module to test it properly



