





'''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       __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(lowercase__							)
				pipe.set_progress_bar_config(disable=lowercase__							)

				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=lowercase__ ,						generator=lowercase__ ,						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










from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


_a						=   {
    "configuration_funnel": ["FUNNEL_PRETRAINED_CONFIG_ARCHIVE_MAP", "FunnelConfig"],
    "convert_funnel_original_tf_checkpoint_to_pytorch": [],
    "tokenization_funnel": ["FunnelTokenizer"],
}

try:
			if not is_tokenizers_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			_a						=   ["FunnelTokenizerFast"]

try:
			if not is_torch_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			_a						=   [
			    "FUNNEL_PRETRAINED_MODEL_ARCHIVE_LIST",
			    "FunnelBaseModel",
			    "FunnelForMaskedLM",
			    "FunnelForMultipleChoice",
			    "FunnelForPreTraining",
			    "FunnelForQuestionAnswering",
			    "FunnelForSequenceClassification",
			    "FunnelForTokenClassification",
			    "FunnelModel",
			    "FunnelPreTrainedModel",
			    "load_tf_weights_in_funnel",
			]

try:
			if not is_tf_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			_a						=   [
			    "TF_FUNNEL_PRETRAINED_MODEL_ARCHIVE_LIST",
			    "TFFunnelBaseModel",
			    "TFFunnelForMaskedLM",
			    "TFFunnelForMultipleChoice",
			    "TFFunnelForPreTraining",
			    "TFFunnelForQuestionAnswering",
			    "TFFunnelForSequenceClassification",
			    "TFFunnelForTokenClassification",
			    "TFFunnelModel",
			    "TFFunnelPreTrainedModel",
			]


if TYPE_CHECKING:
			from .configuration_funnel import FUNNEL_PRETRAINED_CONFIG_ARCHIVE_MAP, FunnelConfig
			from .tokenization_funnel import FunnelTokenizer

			try:
						if not is_tokenizers_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .tokenization_funnel_fast import FunnelTokenizerFast

			try:
						if not is_torch_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .modeling_funnel import (
						    FUNNEL_PRETRAINED_MODEL_ARCHIVE_LIST,
						    FunnelBaseModel,
						    FunnelForMaskedLM,
						    FunnelForMultipleChoice,
						    FunnelForPreTraining,
						    FunnelForQuestionAnswering,
						    FunnelForSequenceClassification,
						    FunnelForTokenClassification,
						    FunnelModel,
						    FunnelPreTrainedModel,
						    load_tf_weights_in_funnel,
						)

			try:
						if not is_tf_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .modeling_tf_funnel import (
						    TF_FUNNEL_PRETRAINED_MODEL_ARCHIVE_LIST,
						    TFFunnelBaseModel,
						    TFFunnelForMaskedLM,
						    TFFunnelForMultipleChoice,
						    TFFunnelForPreTraining,
						    TFFunnelForQuestionAnswering,
						    TFFunnelForSequenceClassification,
						    TFFunnelForTokenClassification,
						    TFFunnelModel,
						    TFFunnelPreTrainedModel,
						)

else:
			import sys

			_a						=   _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)



