"""simple docstring"""




from __future__ import annotations

import unittest

from transformers import is_tf_available
from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow


if is_tf_available():
				import numpy as np
				import tensorflow as tf

				from transformers import TFCamembertModel
@require_tf
@require_sentencepiece
@require_tokenizers
class 			UpperCamelCase__(			unittest.TestCase ):





						@slow
						def 				snake_case__	(       self     )					->				Any:
													A__	     =							TFCamembertModel.from_pretrained('jplu/tf-camembert-base'     )

													A__	     =							tf.convert_to_tensor(
													    [[5, 1_21, 11, 6_60, 16, 7_30, 2_55_43, 1_10, 83, 6]]		,dtype=tf.intaa		,)  # J'aime le camembert !"

													A__	     =							model(__UpperCAmelCase     )['last_hidden_state']
													A__	     =							tf.TensorShape((1, 10, 7_68)     )
													self.assertEqual(output.shape		,__UpperCAmelCase     )
													# compare the actual values for a slice.
													A__	     =							tf.convert_to_tensor(
													    [[[-0.0_2_5_4, 0.0_2_3_5, 0.1_0_2_7], [0.0_6_0_6, -0.1_8_1_1, -0.0_4_1_8], [-0.1_5_6_1, -0.1_1_2_7, 0.2_6_8_7]]]		,dtype=tf.floataa		,)
													# camembert = torch.hub.load('pytorch/fairseq', 'camembert.v0')
													# camembert.eval()
													# expected_slice = roberta.model.forward(input_ids)[0][:, :3, :3].detach()

													self.assertTrue(np.allclose(output[:, :3, :3].numpy()		,expected_slice.numpy()		,atol=1e-4     )     )






"""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     UpperCamelCase__(			unittest.TestCase ):





						@property
						def 				snake_case__	(       self     )					->				int:
													return (
													    "CUDAExecutionProvider",
													    {
													        "gpu_mem_limit": "15000000000",  # 15GB
													        "arena_extend_strategy": "kSameAsRequested",
													    },
													)





						@property
						def 				snake_case__	(       self     )					->				Union[str, Any]:
													A__	     =							ort.SessionOptions()
													A__	     =							False
													return options





						def 				snake_case__	(       self     )					->				str:
													A__	     =							load_image(
													    'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main'
													    '/in_paint/overture-creations-5sI6fQgYIuo.png'     )
													A__	     =							load_image(
													    'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main'
													    '/in_paint/overture-creations-5sI6fQgYIuo_mask.png'     )
													A__	     =							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
													A__	     =							OnnxStableDiffusionInpaintPipelineLegacy.from_pretrained(
													    'CompVis/stable-diffusion-v1-4'		,revision='onnx'		,safety_checker=__UpperCAmelCase		,feature_extractor=__UpperCAmelCase		,provider=self.gpu_provider		,sess_options=self.gpu_options		,)
													pipe.set_progress_bar_config(disable=__UpperCAmelCase     )

													A__	     =							'A red cat sitting on a park bench'

													A__	     =							np.random.RandomState(0     )
													A__	     =							pipe(
													    prompt=__UpperCAmelCase		,image=__UpperCAmelCase		,mask_image=__UpperCAmelCase		,strength=0.7_5		,guidance_scale=7.5		,num_inference_steps=15		,generator=__UpperCAmelCase		,output_type='np'		,)

													A__	     =							output.images[0]

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





