


'''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


snake_case_						:			Dict													=							False

class 						A__							(		unittest.TestCase  ):
						pass

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




						def 							__UpperCamelCase				(       self					:      int  )							->     str:


										"""simple docstring"""





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

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

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

										assert image.shape == (1, 512, 512, 3)
										_SCREAMING_SNAKE_CASE			  =np.array([0.04_41, 0.04_69, 0.05_07, 0.05_75, 0.06_32, 0.06_50, 0.08_65, 0.09_09, 0.09_45]  )

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



from typing import TYPE_CHECKING

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


snake_case_						:			Optional[Any]													=							{
    '''configuration_audio_spectrogram_transformer''': [
        '''AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''ASTConfig''',
    ]
}

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							snake_case_						:			Optional[Any]													=							[
							    '''AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_MODEL_ARCHIVE_LIST''',
							    '''ASTForAudioClassification''',
							    '''ASTModel''',
							    '''ASTPreTrainedModel''',
							]

try:
							if not is_speech_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							snake_case_						:			List[Any]													=							['''ASTFeatureExtractor''']

if TYPE_CHECKING:
							from .configuration_audio_spectrogram_transformer import (
							    AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP,
							    ASTConfig,
							)

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_audio_spectrogram_transformer import (
														    AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
														    ASTForAudioClassification,
														    ASTModel,
														    ASTPreTrainedModel,
														)

							try:
														if not is_speech_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .feature_extraction_audio_spectrogram_transformer import ASTFeatureExtractor


else:
							import sys

							snake_case_						:			Optional[Any]													=							_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)