


import collections
import inspect
import unittest

from transformers import DonutSwinConfig
from transformers.testing_utils import require_torch, slow, torch_device
from transformers.utils import is_torch_available

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, _config_zero_init, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
    import torch
    from torch import nn

    from transformers import DonutSwinModel
    from transformers.models.donut.modeling_donut_swin import DONUT_SWIN_PRETRAINED_MODEL_ARCHIVE_LIST







class       _lowercase			:


       """simple docstring"""




       def __init__(       self							:      Tuple ,				__lowerCamelCase							:      Dict ,				__lowerCamelCase							:      Any=13 ,				__lowerCamelCase							:      int=32 ,				__lowerCamelCase							:      Optional[int]=2 ,				__lowerCamelCase							:      Optional[Any]=3 ,				__lowerCamelCase							:      List[str]=16 ,				__lowerCamelCase							:      Tuple=[1, 2, 1] ,				__lowerCamelCase							:      Union[str, Any]=[2, 2, 4] ,				__lowerCamelCase							:      Optional[Any]=2 ,				__lowerCamelCase							:      Optional[Any]=2.0 ,				__lowerCamelCase							:      Optional[Any]=True ,				__lowerCamelCase							:      List[str]=0.0 ,				__lowerCamelCase							:      Tuple=0.0 ,				__lowerCamelCase							:      int=0.1 ,				__lowerCamelCase							:      Optional[Any]="gelu" ,				__lowerCamelCase							:      Optional[Any]=False ,				__lowerCamelCase							:      Optional[int]=True ,				__lowerCamelCase							:      Union[str, Any]=0.0_2 ,				__lowerCamelCase							:      Optional[int]=1E-5 ,				__lowerCamelCase							:      int=True ,				__lowerCamelCase							:      List[str]=None ,				__lowerCamelCase							:      str=True ,				__lowerCamelCase							:      List[Any]=10 ,				__lowerCamelCase							:      Tuple=8 ,				):


             '''simple docstring'''



             lowerCamelCase__		:    Tuple   =  parent
             lowerCamelCase__		:    Dict   =  batch_size
             lowerCamelCase__		:    Tuple   =  image_size
             lowerCamelCase__		:    Union[str, Any]   =  patch_size
             lowerCamelCase__		:    Dict   =  num_channels
             lowerCamelCase__		:    Optional[int]   =  embed_dim
             lowerCamelCase__		:    Union[str, Any]   =  depths
             lowerCamelCase__		:    Tuple   =  num_heads
             lowerCamelCase__		:    str   =  window_size
             lowerCamelCase__		:    Union[str, Any]   =  mlp_ratio
             lowerCamelCase__		:    Dict   =  qkv_bias
             lowerCamelCase__		:    Optional[Any]   =  hidden_dropout_prob
             lowerCamelCase__		:    Tuple   =  attention_probs_dropout_prob
             lowerCamelCase__		:    Union[str, Any]   =  drop_path_rate
             lowerCamelCase__		:    Any   =  hidden_act
             lowerCamelCase__		:    Tuple   =  use_absolute_embeddings
             lowerCamelCase__		:    Optional[Any]   =  patch_norm
             lowerCamelCase__		:    Tuple   =  layer_norm_eps
             lowerCamelCase__		:    int   =  initializer_range
             lowerCamelCase__		:    Any   =  is_training
             lowerCamelCase__		:    Union[str, Any]   =  scope
             lowerCamelCase__		:    Dict   =  use_labels
             lowerCamelCase__		:    Optional[int]   =  type_sequence_label_size
             lowerCamelCase__		:    List[str]   =  encoder_stride





       def 						lowerCAmelCase					(       self							:      List[str]	):


             '''simple docstring'''



             lowerCamelCase__		:    Optional[Any]   =  floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]	)

             lowerCamelCase__		:    List[Any]   =  None
             if self.use_labels:
                   lowerCamelCase__		:    Tuple   =  ids_tensor([self.batch_size] ,				self.type_sequence_label_size	)

             lowerCamelCase__		:    str   =  self.get_config()

             return config, pixel_values, labels





       def 						lowerCAmelCase					(       self							:      Tuple	):


             '''simple docstring'''



             return DonutSwinConfig(
                 image_size=self.image_size ,				patch_size=self.patch_size ,				num_channels=self.num_channels ,				embed_dim=self.embed_dim ,				depths=self.depths ,				num_heads=self.num_heads ,				window_size=self.window_size ,				mlp_ratio=self.mlp_ratio ,				qkv_bias=self.qkv_bias ,				hidden_dropout_prob=self.hidden_dropout_prob ,				attention_probs_dropout_prob=self.attention_probs_dropout_prob ,				drop_path_rate=self.drop_path_rate ,				hidden_act=self.hidden_act ,				use_absolute_embeddings=self.use_absolute_embeddings ,				path_norm=self.patch_norm ,				layer_norm_eps=self.layer_norm_eps ,				initializer_range=self.initializer_range ,				encoder_stride=self.encoder_stride ,				)





       def 						lowerCAmelCase					(       self							:      Optional[int] ,				__lowerCamelCase							:      Optional[int] ,				__lowerCamelCase							:      List[Any] ,				__lowerCamelCase							:      Union[str, Any]	):


             '''simple docstring'''



             lowerCamelCase__		:    Optional[Any]   =  DonutSwinModel(config=__lowerCamelCase	)
             model.to(__lowerCamelCase	)
             model.eval()
             lowerCamelCase__		:    Any   =  model(__lowerCamelCase	)

             lowerCamelCase__		:    Dict   =  ((config.image_size // config.patch_size) ** 2) // (4 ** (len(config.depths	) - 1))
             lowerCamelCase__		:    List[str]   =  int(config.embed_dim * 2 ** (len(config.depths	) - 1)	)

             self.parent.assertEqual(result.last_hidden_state.shape ,				(self.batch_size, expected_seq_len, expected_dim)	)





       def 						lowerCAmelCase					(       self							:      int	):


             '''simple docstring'''



             lowerCamelCase__		:    int   =  self.prepare_config_and_inputs()
             (
                 (
                 lowerCamelCase__
             )   ,       (
                 lowerCamelCase__
             )   ,       (
                 lowerCamelCase__
             )   ,       
             )		:    Optional[Any]   =  config_and_inputs
             lowerCamelCase__		:    Any   =  {"pixel_values": pixel_values}
             return config, inputs_dict







@require_torch
class       _lowercase			(							lowercase__							,  lowercase__							,  unittest.TestCase):


       """simple docstring"""




       A__ 						=      (DonutSwinModel,) if is_torch_available() else ()
       A__ 						=      {"feature-extraction": DonutSwinModel} if is_torch_available() else {}
       A__ 						=      True

       A__ 						=      False
       A__ 						=      False
       A__ 						=      False





       def 						lowerCAmelCase					(       self							:      List[str]	):


             '''simple docstring'''



             lowerCamelCase__		:    int   =  DonutSwinModelTester(self	)
             lowerCamelCase__		:    int   =  ConfigTester(self ,				config_class=__lowerCamelCase ,				embed_dim=37	)





       def 						lowerCAmelCase					(       self							:      Union[str, Any]	):


             '''simple docstring'''



             self.create_and_test_config_common_properties()
             self.config_tester.create_and_test_config_to_json_string()
             self.config_tester.create_and_test_config_to_json_file()
             self.config_tester.create_and_test_config_from_and_save_pretrained()
             self.config_tester.create_and_test_config_with_num_labels()
             self.config_tester.check_config_can_be_init_without_params()
             self.config_tester.check_config_arguments_init()





       def 						lowerCAmelCase					(       self							:      Tuple	):


             '''simple docstring'''



             return





       def 						lowerCAmelCase					(       self							:      Optional[int]	):


             '''simple docstring'''



             lowerCamelCase__		:    Optional[int]   =  self.model_tester.prepare_config_and_inputs()
             self.model_tester.create_and_check_model(*__lowerCamelCase	)





       def 						lowerCAmelCase					(       self							:      Optional[Any]	):


             '''simple docstring'''



             pass





       def 						lowerCAmelCase					(       self							:      Optional[Any]	):


             '''simple docstring'''



             lowerCamelCase__   ,       lowerCamelCase__		:    Optional[Any]   =  self.model_tester.prepare_config_and_inputs_for_common()

             for model_class in self.all_model_classes:
                   lowerCamelCase__		:    Any   =  model_class(__lowerCamelCase	)
                   self.assertIsInstance(model.get_input_embeddings() ,				(nn.Module)	)
                   lowerCamelCase__		:    Optional[int]   =  model.get_output_embeddings()
                   self.assertTrue(x is None or isinstance(__lowerCamelCase ,				nn.Linear	)	)





       def 						lowerCAmelCase					(       self							:      Optional[int]	):


             '''simple docstring'''



             lowerCamelCase__   ,       lowerCamelCase__		:    Any   =  self.model_tester.prepare_config_and_inputs_for_common()

             for model_class in self.all_model_classes:
                   lowerCamelCase__		:    Dict   =  model_class(__lowerCamelCase	)
                   lowerCamelCase__		:    Union[str, Any]   =  inspect.signature(model.forward	)
                   # signature.parameters is an OrderedDict => so arg_names order is deterministic
                   lowerCamelCase__		:    Optional[Any]   =  [*signature.parameters.keys()]

                   lowerCamelCase__		:    List[Any]   =  ["pixel_values"]
                   self.assertListEqual(arg_names[:1] ,				__lowerCamelCase	)





       def 						lowerCAmelCase					(       self							:      Optional[int]	):


             '''simple docstring'''



             lowerCamelCase__   ,       lowerCamelCase__		:    int   =  self.model_tester.prepare_config_and_inputs_for_common()
             lowerCamelCase__		:    str   =  True

             for model_class in self.all_model_classes:
                   lowerCamelCase__		:    Dict   =  True
                   lowerCamelCase__		:    Dict   =  False
                   lowerCamelCase__		:    Any   =  True
                   lowerCamelCase__		:    Optional[Any]   =  model_class(__lowerCamelCase	)
                   model.to(__lowerCamelCase	)
                   model.eval()
                   with torch.no_grad():
                         lowerCamelCase__		:    Any   =  model(**self._prepare_for_class(__lowerCamelCase ,				__lowerCamelCase	)	)
                   lowerCamelCase__		:    Any   =  outputs.attentions
                   lowerCamelCase__		:    Dict   =  len(self.model_tester.depths	)
                   self.assertEqual(len(__lowerCamelCase	) ,				__lowerCamelCase	)

                   # check that output_attentions also work using config
                   del inputs_dict["output_attentions"]
                   lowerCamelCase__		:    int   =  True
                   lowerCamelCase__		:    Union[str, Any]   =  config.window_size**2
                   lowerCamelCase__		:    Tuple   =  model_class(__lowerCamelCase	)
                   model.to(__lowerCamelCase	)
                   model.eval()
                   with torch.no_grad():
                         lowerCamelCase__		:    List[Any]   =  model(**self._prepare_for_class(__lowerCamelCase ,				__lowerCamelCase	)	)
                   lowerCamelCase__		:    Union[str, Any]   =  outputs.attentions
                   self.assertEqual(len(__lowerCamelCase	) ,				__lowerCamelCase	)

                   self.assertListEqual(
                       list(attentions[0].shape[-3:]	) ,				[self.model_tester.num_heads[0], window_size_squared, window_size_squared] ,				)
                   lowerCamelCase__		:    Dict   =  len(__lowerCamelCase	)

                   # Check attention is always last and order is fine
                   lowerCamelCase__		:    List[Any]   =  True
                   lowerCamelCase__		:    Any   =  True
                   lowerCamelCase__		:    List[str]   =  model_class(__lowerCamelCase	)
                   model.to(__lowerCamelCase	)
                   model.eval()
                   with torch.no_grad():
                         lowerCamelCase__		:    List[Any]   =  model(**self._prepare_for_class(__lowerCamelCase ,				__lowerCamelCase	)	)

                   if hasattr(self.model_tester ,				"num_hidden_states_types"	):
                         lowerCamelCase__		:    Dict   =  self.model_tester.num_hidden_states_types
                   else:
                         # also another +1 for reshaped_hidden_states
                         lowerCamelCase__		:    int   =  2
                   self.assertEqual(out_len + added_hidden_states ,				len(__lowerCamelCase	)	)

                   lowerCamelCase__		:    Union[str, Any]   =  outputs.attentions

                   self.assertEqual(len(__lowerCamelCase	) ,				__lowerCamelCase	)

                   self.assertListEqual(
                       list(self_attentions[0].shape[-3:]	) ,				[self.model_tester.num_heads[0], window_size_squared, window_size_squared] ,				)





       def 						lowerCAmelCase					(       self							:      Tuple ,				__lowerCamelCase							:      Union[str, Any] ,				__lowerCamelCase							:      Any ,				__lowerCamelCase							:      int ,				__lowerCamelCase							:      List[Any]	):


             '''simple docstring'''



             lowerCamelCase__		:    Optional[int]   =  model_class(__lowerCamelCase	)
             model.to(__lowerCamelCase	)
             model.eval()

             with torch.no_grad():
                   lowerCamelCase__		:    List[Any]   =  model(**self._prepare_for_class(__lowerCamelCase ,				__lowerCamelCase	)	)

             lowerCamelCase__		:    int   =  outputs.hidden_states

             lowerCamelCase__		:    Union[str, Any]   =  getattr(
                 self.model_tester ,				"expected_num_hidden_layers" ,				len(self.model_tester.depths	) + 1	)
             self.assertEqual(len(__lowerCamelCase	) ,				__lowerCamelCase	)

             # DonutSwin has a different seq_length
             lowerCamelCase__		:    Dict   =  (
                 config.patch_size
                 if isinstance(config.patch_size ,				collections.abc.Iterable	)
                 else (config.patch_size, config.patch_size)
             )

             lowerCamelCase__		:    Dict   =  (image_size[1] // patch_size[1]) * (image_size[0] // patch_size[0])

             self.assertListEqual(
                 list(hidden_states[0].shape[-2:]	) ,				[num_patches, self.model_tester.embed_dim] ,				)

             lowerCamelCase__		:    str   =  outputs.reshaped_hidden_states
             self.assertEqual(len(__lowerCamelCase	) ,				__lowerCamelCase	)

             lowerCamelCase__   ,       lowerCamelCase__   ,       lowerCamelCase__   ,       lowerCamelCase__		:    List[Any]   =  reshaped_hidden_states[0].shape
             lowerCamelCase__		:    int   =  (
                 reshaped_hidden_states[0].view(__lowerCamelCase ,				__lowerCamelCase ,				height * width	).permute(0 ,				2 ,				1	)
             )
             self.assertListEqual(
                 list(reshaped_hidden_states.shape[-2:]	) ,				[num_patches, self.model_tester.embed_dim] ,				)





       def 						lowerCAmelCase					(       self							:      List[str]	):


             '''simple docstring'''



             lowerCamelCase__   ,       lowerCamelCase__		:    Any   =  self.model_tester.prepare_config_and_inputs_for_common()

             lowerCamelCase__		:    Optional[Any]   =  (
                 self.model_tester.image_size
                 if isinstance(self.model_tester.image_size ,				collections.abc.Iterable	)
                 else (self.model_tester.image_size, self.model_tester.image_size)
             )

             for model_class in self.all_model_classes:
                   lowerCamelCase__		:    List[str]   =  True
                   self.check_hidden_states_output(__lowerCamelCase ,				__lowerCamelCase ,				__lowerCamelCase ,				__lowerCamelCase	)

                   # check that output_hidden_states also work using config
                   del inputs_dict["output_hidden_states"]
                   lowerCamelCase__		:    str   =  True

                   self.check_hidden_states_output(__lowerCamelCase ,				__lowerCamelCase ,				__lowerCamelCase ,				__lowerCamelCase	)





       def 						lowerCAmelCase					(       self							:      Union[str, Any]	):


             '''simple docstring'''



             lowerCamelCase__   ,       lowerCamelCase__		:    Tuple   =  self.model_tester.prepare_config_and_inputs_for_common()
             lowerCamelCase__		:    Any   =  3

             lowerCamelCase__		:    Optional[int]   =  (
                 self.model_tester.image_size
                 if isinstance(self.model_tester.image_size ,				collections.abc.Iterable	)
                 else (self.model_tester.image_size, self.model_tester.image_size)
             )
             lowerCamelCase__		:    List[Any]   =  (
                 config.patch_size
                 if isinstance(config.patch_size ,				collections.abc.Iterable	)
                 else (config.patch_size, config.patch_size)
             )

             lowerCamelCase__		:    int   =  image_size[0] + patch_size[0] - (image_size[0] % patch_size[0])
             lowerCamelCase__		:    int   =  image_size[1] + patch_size[1] - (image_size[1] % patch_size[1])

             for model_class in self.all_model_classes:
                   lowerCamelCase__		:    str   =  True
                   self.check_hidden_states_output(__lowerCamelCase ,				__lowerCamelCase ,				__lowerCamelCase ,				(padded_height, padded_width)	)

                   # check that output_hidden_states also work using config
                   del inputs_dict["output_hidden_states"]
                   lowerCamelCase__		:    int   =  True
                   self.check_hidden_states_output(__lowerCamelCase ,				__lowerCamelCase ,				__lowerCamelCase ,				(padded_height, padded_width)	)





       @slow
       def 						lowerCAmelCase					(       self							:      Optional[Any]	):


             '''simple docstring'''



             for model_name in DONUT_SWIN_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
                   lowerCamelCase__		:    int   =  DonutSwinModel.from_pretrained(__lowerCamelCase	)
                   self.assertIsNotNone(__lowerCamelCase	)





       def 						lowerCAmelCase					(       self							:      Optional[int]	):


             '''simple docstring'''



             lowerCamelCase__   ,       lowerCamelCase__		:    str   =  self.model_tester.prepare_config_and_inputs_for_common()

             lowerCamelCase__		:    int   =  _config_zero_init(__lowerCamelCase	)
             for model_class in self.all_model_classes:
                   lowerCamelCase__		:    int   =  model_class(config=__lowerCamelCase	)
                   for name, param in model.named_parameters():
                         if "embeddings" not in name and param.requires_grad:
                               self.assertIn(
                                   ((param.data.mean() * 1E9).round() / 1E9).item() ,				[0.0, 1.0] ,				msg=f"Parameter {name} of model {model_class} seems not properly initialized" ,				)






from typing import Any, Callable, Dict, List, Optional, Union

import PIL.Image
import torch
from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer

from diffusers import (
    AutoencoderKL,
    DDIMScheduler,
    DiffusionPipeline,
    LMSDiscreteScheduler,
    PNDMScheduler,
    StableDiffusionImgaImgPipeline,
    StableDiffusionInpaintPipelineLegacy,
    StableDiffusionPipeline,
    UNetaDConditionModel,
)
from diffusers.configuration_utils import FrozenDict
from diffusers.pipelines.stable_diffusion.safety_checker import StableDiffusionSafetyChecker
from diffusers.utils import deprecate, logging


A				:   str		= logging.get_logger(__name__)  # pylint: disable=invalid-name







class       _lowercase			(							lowercase__):


       """simple docstring"""




       A__ 						=      ["safety_checker", "feature_extractor"]





       def __init__(       self							:      Optional[Any] ,				__lowerCamelCase							:      AutoencoderKL ,				__lowerCamelCase							:      CLIPTextModel ,				__lowerCamelCase							:      CLIPTokenizer ,				__lowerCamelCase							:      UNetaDConditionModel ,				__lowerCamelCase							:      Union[DDIMScheduler, PNDMScheduler, LMSDiscreteScheduler] ,				__lowerCamelCase							:      StableDiffusionSafetyChecker ,				__lowerCamelCase							:      CLIPImageProcessor ,				__lowerCamelCase							:      bool = True ,				):


             '''simple docstring'''



             super().__init__()
             if hasattr(scheduler.config ,				"steps_offset"	) and scheduler.config.steps_offset != 1:
                   lowerCamelCase__		:    List[str]   =  (
                       f"The configuration file of this scheduler: {scheduler} is outdated. `steps_offset`"
                       f" should be set to 1 instead of {scheduler.config.steps_offset}. Please make sure "
                       "to update the config accordingly as leaving `steps_offset` might led to incorrect results"
                       " in future versions. If you have downloaded this checkpoint from the Hugging Face Hub,"
                       " it would be very nice if you could open a Pull request for the `scheduler/scheduler_config.json`"
                       " file"
                   )
                   deprecate("steps_offset!=1" ,				"1.0.0" ,				__lowerCamelCase ,				standard_warn=__lowerCamelCase	)
                   lowerCamelCase__		:    List[str]   =  dict(scheduler.config	)
                   lowerCamelCase__		:    Optional[Any]   =  1
                   lowerCamelCase__		:    Union[str, Any]   =  FrozenDict(__lowerCamelCase	)

             self.register_modules(
                 vae=__lowerCamelCase ,				text_encoder=__lowerCamelCase ,				tokenizer=__lowerCamelCase ,				unet=__lowerCamelCase ,				scheduler=__lowerCamelCase ,				safety_checker=__lowerCamelCase ,				feature_extractor=__lowerCamelCase ,				)
             self.register_to_config(requires_safety_checker=__lowerCamelCase	)





       @property
       def 						lowerCAmelCase					(       self							:      List[Any]	):


             '''simple docstring'''



             return {k: getattr(self ,				__lowerCamelCase	) for k in self.config.keys() if not k.startswith("_"	)}





       def 						lowerCAmelCase					(       self							:      List[Any] ,				__lowerCamelCase							:      Optional[Union[str, int]] = "auto"	):


             '''simple docstring'''



             if slice_size == "auto":
                   # half the attention head size is usually a good trade-off between
                   # speed and memory
                   lowerCamelCase__		:    Tuple   =  self.unet.config.attention_head_dim // 2
             self.unet.set_attention_slice(__lowerCamelCase	)





       def 						lowerCAmelCase					(       self							:      Optional[Any]	):


             '''simple docstring'''



             self.enable_attention_slicing(__lowerCamelCase	)





       @torch.no_grad()
       def 						lowerCAmelCase					(       self							:      Any ,				__lowerCamelCase							:      Union[str, List[str]] ,				__lowerCamelCase							:      Union[torch.FloatTensor, PIL.Image.Image] ,				__lowerCamelCase							:      Union[torch.FloatTensor, PIL.Image.Image] ,				__lowerCamelCase							:      float = 0.8 ,				__lowerCamelCase							:      Optional[int] = 50 ,				__lowerCamelCase							:      Optional[float] = 7.5 ,				__lowerCamelCase							:      Optional[Union[str, List[str]]] = None ,				__lowerCamelCase							:      Optional[int] = 1 ,				__lowerCamelCase							:      Optional[float] = 0.0 ,				__lowerCamelCase							:      Optional[torch.Generator] = None ,				__lowerCamelCase							:      Optional[str] = "pil" ,				__lowerCamelCase							:      bool = True ,				__lowerCamelCase							:      Optional[Callable[[int, int, torch.FloatTensor], None]] = None ,				__lowerCamelCase							:      int = 1 ,				):


             '''simple docstring'''



             return StableDiffusionInpaintPipelineLegacy(**self.components	)(
                 prompt=__lowerCamelCase ,				image=__lowerCamelCase ,				mask_image=__lowerCamelCase ,				strength=__lowerCamelCase ,				num_inference_steps=__lowerCamelCase ,				guidance_scale=__lowerCamelCase ,				negative_prompt=__lowerCamelCase ,				num_images_per_prompt=__lowerCamelCase ,				eta=__lowerCamelCase ,				generator=__lowerCamelCase ,				output_type=__lowerCamelCase ,				return_dict=__lowerCamelCase ,				callback=__lowerCamelCase ,				)





       @torch.no_grad()
       def 						lowerCAmelCase					(       self							:      Optional[int] ,				__lowerCamelCase							:      Union[str, List[str]] ,				__lowerCamelCase							:      Union[torch.FloatTensor, PIL.Image.Image] ,				__lowerCamelCase							:      float = 0.8 ,				__lowerCamelCase							:      Optional[int] = 50 ,				__lowerCamelCase							:      Optional[float] = 7.5 ,				__lowerCamelCase							:      Optional[Union[str, List[str]]] = None ,				__lowerCamelCase							:      Optional[int] = 1 ,				__lowerCamelCase							:      Optional[float] = 0.0 ,				__lowerCamelCase							:      Optional[torch.Generator] = None ,				__lowerCamelCase							:      Optional[str] = "pil" ,				__lowerCamelCase							:      bool = True ,				__lowerCamelCase							:      Optional[Callable[[int, int, torch.FloatTensor], None]] = None ,				__lowerCamelCase							:      int = 1 ,				**__lowerCamelCase							:      List[str] ,				):


             '''simple docstring'''



             return StableDiffusionImgaImgPipeline(**self.components	)(
                 prompt=__lowerCamelCase ,				image=__lowerCamelCase ,				strength=__lowerCamelCase ,				num_inference_steps=__lowerCamelCase ,				guidance_scale=__lowerCamelCase ,				negative_prompt=__lowerCamelCase ,				num_images_per_prompt=__lowerCamelCase ,				eta=__lowerCamelCase ,				generator=__lowerCamelCase ,				output_type=__lowerCamelCase ,				return_dict=__lowerCamelCase ,				callback=__lowerCamelCase ,				callback_steps=__lowerCamelCase ,				)





       @torch.no_grad()
       def 						lowerCAmelCase					(       self							:      List[Any] ,				__lowerCamelCase							:      Union[str, List[str]] ,				__lowerCamelCase							:      int = 512 ,				__lowerCamelCase							:      int = 512 ,				__lowerCamelCase							:      int = 50 ,				__lowerCamelCase							:      float = 7.5 ,				__lowerCamelCase							:      Optional[Union[str, List[str]]] = None ,				__lowerCamelCase							:      Optional[int] = 1 ,				__lowerCamelCase							:      float = 0.0 ,				__lowerCamelCase							:      Optional[torch.Generator] = None ,				__lowerCamelCase							:      Optional[torch.FloatTensor] = None ,				__lowerCamelCase							:      Optional[str] = "pil" ,				__lowerCamelCase							:      bool = True ,				__lowerCamelCase							:      Optional[Callable[[int, int, torch.FloatTensor], None]] = None ,				__lowerCamelCase							:      int = 1 ,				):


             '''simple docstring'''



             return StableDiffusionPipeline(**self.components	)(
                 prompt=__lowerCamelCase ,				height=__lowerCamelCase ,				width=__lowerCamelCase ,				num_inference_steps=__lowerCamelCase ,				guidance_scale=__lowerCamelCase ,				negative_prompt=__lowerCamelCase ,				num_images_per_prompt=__lowerCamelCase ,				eta=__lowerCamelCase ,				generator=__lowerCamelCase ,				latents=__lowerCamelCase ,				output_type=__lowerCamelCase ,				return_dict=__lowerCamelCase ,				callback=__lowerCamelCase ,				callback_steps=__lowerCamelCase ,				)


