




'''simple docstring'''





from typing import List

import datasets
from datasets.tasks import AudioClassification

from ..folder_based_builder import folder_based_builder


_SCREAMING_SNAKE_CASE							:       Optional[Any]						=			datasets.utils.logging.get_logger(__name__)




class 			_snake_case		(     folder_based_builder.FolderBasedBuilderConfig							):
			lowerCAmelCase_					:				bool							=   None
			lowerCAmelCase_					:				bool							=   None




class 			_snake_case		(     folder_based_builder.FolderBasedBuilder							):
			lowerCAmelCase_					:				List[str]							=   datasets.Audio()
			lowerCAmelCase_					:				List[str]							=   "audio"
			lowerCAmelCase_					:				Dict							=   AudioFolderConfig
			lowerCAmelCase_					:				List[str]  # definition at the bottom of the script
			lowerCAmelCase_					:				Any							=   AudioClassification(audio_column="audio"						,						label_column="label"							)

_SCREAMING_SNAKE_CASE							:       Tuple						=			[
    ".aiff",
    ".au",
    ".avr",
    ".caf",
    ".flac",
    ".htk",
    ".svx",
    ".mat4",
    ".mat5",
    ".mpc2k",
    ".ogg",
    ".paf",
    ".pvf",
    ".raw",
    ".rf64",
    ".sd2",
    ".sds",
    ".ircam",
    ".voc",
    ".w64",
    ".wav",
    ".nist",
    ".wavex",
    ".wve",
    ".xi",
    ".mp3",
    ".opus",
]
_SCREAMING_SNAKE_CASE							:       Optional[Any]						=			AUDIO_EXTENSIONS










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


_SCREAMING_SNAKE_CASE							:       Any						=			False




class 			_snake_case		(     unittest.TestCase							):
			pass




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




			def        lowerCAmelCase__    ( self							)    ->    List[Any]:

										'''simple docstring'''




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

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

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

										assert image.shape == (1, 512, 512, 3)
										snake_case_      =				np.array([0.0_4_4_1, 0.0_4_6_9, 0.0_5_0_7, 0.0_5_7_5, 0.0_6_3_2, 0.0_6_5_0, 0.0_8_6_5, 0.0_9_0_9, 0.0_9_4_5]							)

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




