code: 
  
  
  """simple docstring"""
  
  
  
  
  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
  
  
  __magic_name__          =							logging.get_logger(__name__)  # pylint: disable=invalid-name
  
  
  
  
  class  __snake_case      (lowerCamelCase     ):
  							__a				   =					['''safety_checker''', '''feature_extractor''']
  
  
  
  
  							def __init__(    self:						Tuple    ,       A_:						AutoencoderKL    ,       A_:						CLIPTextModel    ,       A_:						CLIPTokenizer    ,       A_:						UNetaDConditionModel    ,       A_:						Union[DDIMScheduler, PNDMScheduler, LMSDiscreteScheduler]    ,       A_:						StableDiffusionSafetyChecker    ,       A_:						CLIPImageProcessor    ,       A_:						bool = True    ,       ):
  										super().__init__()
  										if hasattr(scheduler.config    ,       """steps_offset"""      ) and scheduler.config.steps_offset != 1:
  													__lowerCamelCase        =			(
  													    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"""    ,       A_    ,       standard_warn=A_      )
  													__lowerCamelCase        =			dict(scheduler.config      )
  													__lowerCamelCase        =			1
  													__lowerCamelCase        =			FrozenDict(A_      )
  
  										self.register_modules(
  										    vae=A_    ,       text_encoder=A_    ,       tokenizer=A_    ,       unet=A_    ,       scheduler=A_    ,       safety_checker=A_    ,       feature_extractor=A_    ,       )
  										self.register_to_config(requires_safety_checker=A_      )
  
  
  
  
  							@property
  							def      __a      (    self:						Optional[int]      ):
  										return {k: getattr(self    ,       A_      ) for k in self.config.keys() if not k.startswith("""_"""      )}
  
  
  
  
  							def      __a      (    self:						List[str]    ,       A_:						Optional[Union[str, int]] = "auto"      ):
  										if slice_size == "auto":
  													# half the attention head size is usually a good trade-off between
  													# speed and memory
  													__lowerCamelCase        =			self.unet.config.attention_head_dim // 2
  										self.unet.set_attention_slice(A_      )
  
  
  
  
  							def      __a      (    self:						Optional[Any]      ):
  										self.enable_attention_slicing(A_      )
  
  
  
  
  							@torch.no_grad()
  							def      __a      (    self:						str    ,       A_:						Union[str, List[str]]    ,       A_:						Union[torch.FloatTensor, PIL.Image.Image]    ,       A_:						Union[torch.FloatTensor, PIL.Image.Image]    ,       A_:						float = 0.8    ,       A_:						Optional[int] = 50    ,       A_:						Optional[float] = 7.5    ,       A_:						Optional[Union[str, List[str]]] = None    ,       A_:						Optional[int] = 1    ,       A_:						Optional[float] = 0.0    ,       A_:						Optional[torch.Generator] = None    ,       A_:						Optional[str] = "pil"    ,       A_:						bool = True    ,       A_:						Optional[Callable[[int, int, torch.FloatTensor], None]] = None    ,       A_:						int = 1    ,       ):
  										# For more information on how this function works, please see: https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion#diffusers.StableDiffusionImg2ImgPipeline
  										return StableDiffusionInpaintPipelineLegacy(**self.components      )(
  										    prompt=A_    ,       image=A_    ,       mask_image=A_    ,       strength=A_    ,       num_inference_steps=A_    ,       guidance_scale=A_    ,       negative_prompt=A_    ,       num_images_per_prompt=A_    ,       eta=A_    ,       generator=A_    ,       output_type=A_    ,       return_dict=A_    ,       callback=A_    ,       )
  
  
  
  
  							@torch.no_grad()
  							def      __a      (    self:						Any    ,       A_:						Union[str, List[str]]    ,       A_:						Union[torch.FloatTensor, PIL.Image.Image]    ,       A_:						float = 0.8    ,       A_:						Optional[int] = 50    ,       A_:						Optional[float] = 7.5    ,       A_:						Optional[Union[str, List[str]]] = None    ,       A_:						Optional[int] = 1    ,       A_:						Optional[float] = 0.0    ,       A_:						Optional[torch.Generator] = None    ,       A_:						Optional[str] = "pil"    ,       A_:						bool = True    ,       A_:						Optional[Callable[[int, int, torch.FloatTensor], None]] = None    ,       A_:						int = 1    ,       **A_:						Optional[int]    ,       ):
  										# For more information on how this function works, please see: https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion#diffusers.StableDiffusionImg2ImgPipeline
  										return StableDiffusionImgaImgPipeline(**self.components      )(
  										    prompt=A_    ,       image=A_    ,       strength=A_    ,       num_inference_steps=A_    ,       guidance_scale=A_    ,       negative_prompt=A_    ,       num_images_per_prompt=A_    ,       eta=A_    ,       generator=A_    ,       output_type=A_    ,       return_dict=A_    ,       callback=A_    ,       callback_steps=A_    ,       )
  
  
  
  
  							@torch.no_grad()
  							def      __a      (    self:						List[str]    ,       A_:						Union[str, List[str]]    ,       A_:						int = 5_12    ,       A_:						int = 5_12    ,       A_:						int = 50    ,       A_:						float = 7.5    ,       A_:						Optional[Union[str, List[str]]] = None    ,       A_:						Optional[int] = 1    ,       A_:						float = 0.0    ,       A_:						Optional[torch.Generator] = None    ,       A_:						Optional[torch.FloatTensor] = None    ,       A_:						Optional[str] = "pil"    ,       A_:						bool = True    ,       A_:						Optional[Callable[[int, int, torch.FloatTensor], None]] = None    ,       A_:						int = 1    ,       ):
  										# For more information on how this function https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion#diffusers.StableDiffusionPipeline
  										return StableDiffusionPipeline(**self.components      )(
  										    prompt=A_    ,       height=A_    ,       width=A_    ,       num_inference_steps=A_    ,       guidance_scale=A_    ,       negative_prompt=A_    ,       num_images_per_prompt=A_    ,       eta=A_    ,       generator=A_    ,       latents=A_    ,       output_type=A_    ,       return_dict=A_    ,       callback=A_    ,       callback_steps=A_    ,       )
  
  
  
  
  
style_context: 
  
  
  """simple docstring"""
  
  
  
  
  from typing import TYPE_CHECKING
  
  from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available
  
  
  __magic_name__	:   Optional[Any]          =							{
      'configuration_flaubert': ['FLAUBERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FlaubertConfig', 'FlaubertOnnxConfig'],
      'tokenization_flaubert': ['FlaubertTokenizer'],
  }
  
  try:
  					if not is_torch_available():
  										raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
  					pass
  else:
  					__magic_name__	:   List[Any]          =							[
  					    'FLAUBERT_PRETRAINED_MODEL_ARCHIVE_LIST',
  					    'FlaubertForMultipleChoice',
  					    'FlaubertForQuestionAnswering',
  					    'FlaubertForQuestionAnsweringSimple',
  					    'FlaubertForSequenceClassification',
  					    'FlaubertForTokenClassification',
  					    'FlaubertModel',
  					    'FlaubertWithLMHeadModel',
  					    'FlaubertPreTrainedModel',
  					]
  
  try:
  					if not is_tf_available():
  										raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
  					pass
  else:
  					__magic_name__	:   Tuple          =							[
  					    'TF_FLAUBERT_PRETRAINED_MODEL_ARCHIVE_LIST',
  					    'TFFlaubertForMultipleChoice',
  					    'TFFlaubertForQuestionAnsweringSimple',
  					    'TFFlaubertForSequenceClassification',
  					    'TFFlaubertForTokenClassification',
  					    'TFFlaubertModel',
  					    'TFFlaubertPreTrainedModel',
  					    'TFFlaubertWithLMHeadModel',
  					]
  
  
  if TYPE_CHECKING:
  					from .configuration_flaubert import FLAUBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, FlaubertConfig, FlaubertOnnxConfig
  					from .tokenization_flaubert import FlaubertTokenizer
  
  					try:
  										if not is_torch_available():
  															raise OptionalDependencyNotAvailable()
  					except OptionalDependencyNotAvailable:
  										pass
  					else:
  										from .modeling_flaubert import (
  										    FLAUBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
  										    FlaubertForMultipleChoice,
  										    FlaubertForQuestionAnswering,
  										    FlaubertForQuestionAnsweringSimple,
  										    FlaubertForSequenceClassification,
  										    FlaubertForTokenClassification,
  										    FlaubertModel,
  										    FlaubertPreTrainedModel,
  										    FlaubertWithLMHeadModel,
  										)
  
  					try:
  										if not is_tf_available():
  															raise OptionalDependencyNotAvailable()
  					except OptionalDependencyNotAvailable:
  										pass
  					else:
  										from .modeling_tf_flaubert import (
  										    TF_FLAUBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
  										    TFFlaubertForMultipleChoice,
  										    TFFlaubertForQuestionAnsweringSimple,
  										    TFFlaubertForSequenceClassification,
  										    TFFlaubertForTokenClassification,
  										    TFFlaubertModel,
  										    TFFlaubertPreTrainedModel,
  										    TFFlaubertWithLMHeadModel,
  										)
  
  else:
  					import sys
  
  					__magic_name__	:   List[str]          =							_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)
  
  
  
  
  