
'''simple docstring'''







import unittest

import numpy as np

from diffusers import OnnxStableDiffusionInpaintPipelineLegacy
from diffusers.utils.testing_utils import (
    is_onnx_available,
    load_image,
    load_numpy,
    nightly,
    require_onnxruntime,
    require_torch_gpu,
)


if is_onnx_available():
							import onnxruntime as ort






@nightly
@require_onnxruntime
@require_torch_gpu
class 			lowerCAmelCase__       (  unittest.TestCase					):






					@property
					def      _snake_case   (       self		):


											"""simple docstring"""





											return (
											    "CUDAExecutionProvider",
											    {
											        "gpu_mem_limit": "15000000000",  # 15GB
											        "arena_extend_strategy": "kSameAsRequested",
											    },
											)






					@property
					def      _snake_case   (       self		):


											"""simple docstring"""





											lowercase_     :					Optional[Any]													=	ort.SessionOptions()
											lowercase_     :					Optional[int]													=	False
											return options






					def      _snake_case   (       self		):


											"""simple docstring"""





											lowercase_     :					Dict													=	load_image(
											    '''https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main'''
											    '''/in_paint/overture-creations-5sI6fQgYIuo.png'''		)
											lowercase_     :					int													=	load_image(
											    '''https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main'''
											    '''/in_paint/overture-creations-5sI6fQgYIuo_mask.png'''		)
											lowercase_     :					Optional[Any]													=	load_numpy(
											    '''https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main'''
											    '''/in_paint/red_cat_sitting_on_a_park_bench_onnx.npy'''		)

											# using the PNDM scheduler by default
											lowercase_     :					Any													=	OnnxStableDiffusionInpaintPipelineLegacy.from_pretrained(
											    '''CompVis/stable-diffusion-v1-4'''    ,							revision='''onnx'''    ,							safety_checker=__SCREAMING_SNAKE_CASE    ,							feature_extractor=__SCREAMING_SNAKE_CASE    ,							provider=self.gpu_provider    ,							sess_options=self.gpu_options    ,							)
											pipe.set_progress_bar_config(disable=__SCREAMING_SNAKE_CASE		)

											lowercase_     :					Any													=	'''A red cat sitting on a park bench'''

											lowercase_     :					Tuple													=	np.random.RandomState(0		)
											lowercase_     :					Dict													=	pipe(
											    prompt=__SCREAMING_SNAKE_CASE    ,							image=__SCREAMING_SNAKE_CASE    ,							mask_image=__SCREAMING_SNAKE_CASE    ,							strength=0.75    ,							guidance_scale=7.5    ,							num_inference_steps=15    ,							generator=__SCREAMING_SNAKE_CASE    ,							output_type='''np'''    ,							)

											lowercase_     :					Any													=	output.images[0]

											assert image.shape == (5_12, 5_12, 3)
											assert np.abs(expected_image - image		).max() < 1E-2





'''simple docstring'''







def  snake_case_		(    __SCREAMING_SNAKE_CASE :			str							):



						"""simple docstring"""





						assert column_title.isupper()
						lowercase_     :					Dict													=	0
						lowercase_     :					Tuple													=	len(__SCREAMING_SNAKE_CASE							) - 1
						lowercase_     :					Optional[int]													=	0

						while index >= 0:
												lowercase_     :					Optional[Any]													=	(ord(column_title[index]							) - 64) * pow(26				,				__SCREAMING_SNAKE_CASE							)
												answer += value
												power += 1
												index -= 1

						return answer


if __name__ == "__main__":
							from doctest import testmod

							testmod()



