





'''simple docstring'''


from typing import TYPE_CHECKING

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


_SCREAMING_SNAKE_CASE									=				{
    "configuration_mctct": ["MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP", "MCTCTConfig"],
    "feature_extraction_mctct": ["MCTCTFeatureExtractor"],
    "processing_mctct": ["MCTCTProcessor"],
}


try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       _SCREAMING_SNAKE_CASE									=				[
           "MCTCT_PRETRAINED_MODEL_ARCHIVE_LIST",
           "MCTCTForCTC",
           "MCTCTModel",
           "MCTCTPreTrainedModel",
       ]


if TYPE_CHECKING:
       from .configuration_mctct import MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP, MCTCTConfig
       from .feature_extraction_mctct import MCTCTFeatureExtractor
       from .processing_mctct import MCTCTProcessor

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_mctct import MCTCT_PRETRAINED_MODEL_ARCHIVE_LIST, MCTCTForCTC, MCTCTModel, MCTCTPreTrainedModel

else:
       import sys

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



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


_UpperCAmelCase    :     List[Any]         =       False







class lowercase_       (		unittest.TestCase			):







   """simple docstring"""

   pass







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







   """simple docstring"""

   def 	__UpperCAmelCase   (      self      :			List[str]     )  ->			Dict:
        _A    		=  VersatileDiffusionImageVariationPipeline.from_pretrained('shi-labs/versatile-diffusion'     )
        pipe.to(UpperCamelCase__     )
        pipe.set_progress_bar_config(disable=UpperCamelCase__     )

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

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

        assert image.shape == (1, 5_12, 5_12, 3)
        _A    		=  np.array([0.0_441, 0.0_469, 0.0_507, 0.0_575, 0.0_632, 0.0_650, 0.0_865, 0.0_909, 0.0_945]     )

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



