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
  
  
  UpperCamelCase_     			=       logging.get_logger(__name__)  # pylint: disable=invalid-name
  
  
  class   a_  (_a    ):
         __lowerCAmelCase    :				Optional[Any]    =      ["""safety_checker""", """feature_extractor"""]
  
  
  
  
         def __init__(     self   ,   snake_case_   ,   snake_case_   ,   snake_case_   ,   snake_case_   ,   snake_case_   ,   snake_case_   ,   snake_case_   ,   snake_case_ = True   ,   ):
           super().__init__()
           if hasattr(scheduler.config   ,   """steps_offset"""  ) and scheduler.config.steps_offset != 1:
             _lowerCAmelCase       :  Optional[int]   				=					(
                 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"""   ,   snake_case_   ,   standard_warn=snake_case_  )
             _lowerCAmelCase       :  Optional[int]   				=					dict(scheduler.config  )
             _lowerCAmelCase       :  Dict   				=					1
             _lowerCAmelCase       :  Dict   				=					FrozenDict(snake_case_  )
  
           self.register_modules(
               vae=snake_case_   ,   text_encoder=snake_case_   ,   tokenizer=snake_case_   ,   unet=snake_case_   ,   scheduler=snake_case_   ,   safety_checker=snake_case_   ,   feature_extractor=snake_case_   ,   )
           self.register_to_config(requires_safety_checker=snake_case_  )
  
  
  
  
         @property
         def 							__UpperCamelCase       (     self  ):
           return {k: getattr(self   ,   snake_case_  ) for k in self.config.keys() if not k.startswith("""_"""  )}
  
  
  
  
         def 							__UpperCamelCase       (     self   ,   snake_case_ = "auto"  ):
           if slice_size == "auto":
             # half the attention head size is usually a good trade-off between
             # speed and memory
             _lowerCAmelCase       :  Any   				=					self.unet.config.attention_head_dim // 2
           self.unet.set_attention_slice(snake_case_  )
  
  
  
  
         def 							__UpperCamelCase       (     self  ):
           self.enable_attention_slicing(snake_case_  )
  
  
  
  
         @torch.no_grad()
         def 							__UpperCamelCase       (     self   ,   snake_case_   ,   snake_case_   ,   snake_case_   ,   snake_case_ = 0.8   ,   snake_case_ = 5_0   ,   snake_case_ = 7.5   ,   snake_case_ = None   ,   snake_case_ = 1   ,   snake_case_ = 0.0   ,   snake_case_ = None   ,   snake_case_ = "pil"   ,   snake_case_ = True   ,   snake_case_ = None   ,   snake_case_ = 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=snake_case_   ,   image=snake_case_   ,   mask_image=snake_case_   ,   strength=snake_case_   ,   num_inference_steps=snake_case_   ,   guidance_scale=snake_case_   ,   negative_prompt=snake_case_   ,   num_images_per_prompt=snake_case_   ,   eta=snake_case_   ,   generator=snake_case_   ,   output_type=snake_case_   ,   return_dict=snake_case_   ,   callback=snake_case_   ,   )
  
  
  
  
         @torch.no_grad()
         def 							__UpperCamelCase       (     self   ,   snake_case_   ,   snake_case_   ,   snake_case_ = 0.8   ,   snake_case_ = 5_0   ,   snake_case_ = 7.5   ,   snake_case_ = None   ,   snake_case_ = 1   ,   snake_case_ = 0.0   ,   snake_case_ = None   ,   snake_case_ = "pil"   ,   snake_case_ = True   ,   snake_case_ = None   ,   snake_case_ = 1   ,   **snake_case_   ,   ):
           # 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=snake_case_   ,   image=snake_case_   ,   strength=snake_case_   ,   num_inference_steps=snake_case_   ,   guidance_scale=snake_case_   ,   negative_prompt=snake_case_   ,   num_images_per_prompt=snake_case_   ,   eta=snake_case_   ,   generator=snake_case_   ,   output_type=snake_case_   ,   return_dict=snake_case_   ,   callback=snake_case_   ,   callback_steps=snake_case_   ,   )
  
  
  
  
  
  
  
         @torch.no_grad()
         def 							__UpperCamelCase       (     self   ,   snake_case_   ,   snake_case_ = 5_1_2   ,   snake_case_ = 5_1_2   ,   snake_case_ = 5_0   ,   snake_case_ = 7.5   ,   snake_case_ = None   ,   snake_case_ = 1   ,   snake_case_ = 0.0   ,   snake_case_ = None   ,   snake_case_ = None   ,   snake_case_ = "pil"   ,   snake_case_ = True   ,   snake_case_ = None   ,   snake_case_ = 1   ,   ):
           # For more information on how this function https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion#diffusers.StableDiffusionPipeline
           return StableDiffusionPipeline(**self.components  )(
               prompt=snake_case_   ,   height=snake_case_   ,   width=snake_case_   ,   num_inference_steps=snake_case_   ,   guidance_scale=snake_case_   ,   negative_prompt=snake_case_   ,   num_images_per_prompt=snake_case_   ,   eta=snake_case_   ,   generator=snake_case_   ,   latents=snake_case_   ,   output_type=snake_case_   ,   return_dict=snake_case_   ,   callback=snake_case_   ,   callback_steps=snake_case_   ,   )
  
  
  
style_context: 
  '''simple docstring'''
  
  import os
  
  
  def 	_UpperCAmelCase				(  )    ->						int:
    _lowerCAmelCase       :  Optional[int]   				=					os.path.dirname(os.path.realpath(_lowerCamelCase		)		)
    _lowerCAmelCase       :  Optional[Any]   				=					os.path.join(_lowerCamelCase  ,      """triangle.txt"""		)
  
    with open(_lowerCamelCase		) as in_file:
      _lowerCAmelCase       :  List[Any]   				=					[[int(_lowerCamelCase		) for i in line.split()] for line in in_file]
  
    while len(_lowerCamelCase		) != 1:
      _lowerCAmelCase       :  Any   				=					triangle.pop()
      _lowerCAmelCase       :  List[str]   				=					triangle[-1]
      for j in range(len(_lowerCamelCase		) - 1		):
        curr_row[j] += max(last_row[j]  ,      last_row[j + 1]		)
    return triangle[0][0]
  
  
  if __name__ == "__main__":
       print(solution())
  
  
  