
"""simple docstring"""





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)			->			Optional[int]:






							'''simple docstring'''
							_UpperCamelCase									=    VersatileDiffusionImageVariationPipeline.from_pretrained('''shi-labs/versatile-diffusion''')
							pipe.to(__a)
							pipe.set_progress_bar_config(disable=__a)

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

							_UpperCamelCase									=    image[0, 2_53:2_56, 2_53:2_56, -1]

							assert image.shape == (1, 5_12, 5_12, 3)
							_UpperCamelCase									=    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








from ...configuration_utils import PretrainedConfig
from ...utils import logging


UpperCamelCase_						:     Optional[int]	       =							logging.get_logger(__name__)




class   __lowercase						(						__snake_case       ):
	_A       =   "timm_backbone"






	def __init__(self				: Any      ,	snake_case				: List[Any]=None      ,	snake_case				: int=3      ,	snake_case				: Dict=True      ,	snake_case				: Union[str, Any]=True      ,	snake_case				: Any=None      ,	**snake_case				: int      ,	) ->			Optional[int]:
							super().__init__(**snake_case    )
							_lowercase       :	Dict           =   backbone
							_lowercase       :	Optional[Any]           =   num_channels
							_lowercase       :	Union[str, Any]           =   features_only
							_lowercase       :	Tuple           =   use_pretrained_backbone
							_lowercase       :	List[str]           =   True
							_lowercase       :	Tuple           =   out_indices if out_indices is not None else (-1,)




