gokaygokay commited on
Commit
5646d18
1 Parent(s): c6243d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -9,6 +9,7 @@ import cv2
9
  import numpy as np
10
  from diffusers import StableDiffusionControlNetImg2ImgPipeline, ControlNetModel, DDIMScheduler
11
  from diffusers.models import AutoencoderKL
 
12
  from RealESRGAN import RealESRGAN
13
  import gradio as gr
14
  import subprocess
@@ -111,6 +112,8 @@ class ModelManager:
111
  progress(0, desc="Loading Stable Diffusion pipeline...")
112
  self.pipe = self.setup_pipeline()
113
  self.pipe.to(device)
 
 
114
  if USE_TORCH_COMPILE:
115
  progress(0.5, desc="Compiling the model...")
116
  self.pipe.unet = torch.compile(self.pipe.unet, mode="reduce-overhead", fullgraph=True)
 
9
  import numpy as np
10
  from diffusers import StableDiffusionControlNetImg2ImgPipeline, ControlNetModel, DDIMScheduler
11
  from diffusers.models import AutoencoderKL
12
+ from diffusers.models.attention_processor import AttnProcessor2_0
13
  from RealESRGAN import RealESRGAN
14
  import gradio as gr
15
  import subprocess
 
112
  progress(0, desc="Loading Stable Diffusion pipeline...")
113
  self.pipe = self.setup_pipeline()
114
  self.pipe.to(device)
115
+ self.pipe.unet.set_attn_processor(AttnProcessor2_0())
116
+ self.pipe.vae.set_attn_processor(AttnProcessor2_0())
117
  if USE_TORCH_COMPILE:
118
  progress(0.5, desc="Compiling the model...")
119
  self.pipe.unet = torch.compile(self.pipe.unet, mode="reduce-overhead", fullgraph=True)