"""simple docstring"""






import random
import unittest

import torch

from diffusers import IFImgaImgPipeline
from diffusers.utils import floats_tensor
from diffusers.utils.import_utils import is_xformers_available
from diffusers.utils.testing_utils import skip_mps, torch_device

from ..pipeline_params import (
    TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS,
    TEXT_GUIDED_IMAGE_VARIATION_PARAMS,
)
from ..test_pipelines_common import PipelineTesterMixin
from . import IFPipelineTesterMixin
@skip_mps
class 							snake_case			(					__snake_case ,       __snake_case ,       unittest.TestCase							):




					"""simple docstring"""

					snake_case__							       =					IFImgaImgPipeline
					snake_case__							       =					TEXT_GUIDED_IMAGE_VARIATION_PARAMS - {"width", "height"}
					snake_case__							       =					TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS
					snake_case__							       =					PipelineTesterMixin.required_optional_params - {"latents"}







					def 						__lowerCAmelCase		(							self  :      str     ):
									return self._get_dummy_components()







					def 						__lowerCAmelCase		(							self  :      List[str]       ,lowerCamelCase__  :      Tuple       ,lowerCamelCase__  :      Dict=0     ):

									if str(__A     ).startswith('mps'     ):
													UpperCAmelCase__			 =				torch.manual_seed(__A     )
									else:
													UpperCAmelCase__			 =				torch.Generator(device=__A     ).manual_seed(__A     )

									UpperCAmelCase__			 =				floats_tensor((1, 3, 32, 32)       ,rng=random.Random(__A     )     ).to(__A     )

									UpperCAmelCase__			 =				{
									    'prompt': 'A painting of a squirrel eating a burger',
									    'image': image,
									    'generator': generator,
									    'num_inference_steps': 2,
									    'output_type': 'numpy',
									}

									return inputs







					def 						__lowerCAmelCase		(							self  :      Union[str, Any]     ):
									self._test_save_load_optional_components()







					@unittest.skipIf(
					    torch_device != 'cuda' or not is_xformers_available()       ,reason='XFormers attention is only available with CUDA and `xformers` installed'       ,)
					def 						__lowerCAmelCase		(							self  :      List[Any]     ):
									self._test_xformers_attention_forwardGenerator_pass(expected_max_diff=1e-3     )







					@unittest.skipIf(torch_device != 'cuda'       ,reason='float16 requires CUDA'     )
					def 						__lowerCAmelCase		(							self  :      Dict     ):
									super().test_save_load_floataa(expected_max_diff=1e-1     )







					@unittest.skipIf(torch_device != 'cuda'       ,reason='float16 requires CUDA'     )
					def 						__lowerCAmelCase		(							self  :      Optional[Any]     ):
									super().test_floataa_inference(expected_max_diff=1e-1     )







					def 						__lowerCAmelCase		(							self  :      List[str]     ):
									self._test_attention_slicing_forward_pass(expected_max_diff=1e-2     )







					def 						__lowerCAmelCase		(							self  :      str     ):
									self._test_save_load_local()







					def 						__lowerCAmelCase		(							self  :      Dict     ):
									self._test_inference_batch_single_identical(
									    expected_max_diff=1e-2       ,)











"""simple docstring"""







from ...configuration_utils import PretrainedConfig
from ...utils import logging


__a							:						Union[str, Any]   							=			logging.get_logger(__name__)

__a							:						Optional[Any]   							=			{
    'tau/splinter-base': 'https://huggingface.co/tau/splinter-base/resolve/main/config.json',
    'tau/splinter-base-qass': 'https://huggingface.co/tau/splinter-base-qass/resolve/main/config.json',
    'tau/splinter-large': 'https://huggingface.co/tau/splinter-large/resolve/main/config.json',
    'tau/splinter-large-qass': 'https://huggingface.co/tau/splinter-large-qass/resolve/main/config.json',
    # See all Splinter models at https://huggingface.co/models?filter=splinter
}







class 							_SCREAMING_SNAKE_CASE    (	__snake_case				):





							"""simple docstring"""





							_SCREAMING_SNAKE_CASE     ='splinter'




							def __init__( self:  Dict					,		__A:  List[Any]=30522					,		__A:  str=768					,		__A:  int=12					,		__A:  str=12					,		__A:  Tuple=3072					,		__A:  Dict="gelu"					,		__A:  Optional[int]=0.1					,		__A:  List[str]=0.1					,		__A:  str=512					,		__A:  List[Any]=2					,		__A:  Any=0.0_2					,		__A:  Any=1e-12					,		__A:  Tuple=True					,		__A:  List[Any]=0					,		__A:  List[str]=104					,		**__A:  Union[str, Any]					,		):

												'''simple docstring'''

												super().__init__(pad_token_id=__A					,		**__A     )

												a__ 							=	vocab_size
												a__ 							=	max_position_embeddings
												a__ 							=	hidden_size
												a__ 							=	num_hidden_layers
												a__ 							=	num_attention_heads
												a__ 							=	intermediate_size
												a__ 							=	hidden_act
												a__ 							=	hidden_dropout_prob
												a__ 							=	attention_probs_dropout_prob
												a__ 							=	initializer_range
												a__ 							=	type_vocab_size
												a__ 							=	layer_norm_eps
												a__ 							=	use_cache
												a__ 							=	question_token_id


