1inkusFace commited on
Commit
663543d
·
verified ·
1 Parent(s): 4c5e2e9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -147,19 +147,17 @@ def load_model():
147
 
148
  pipe, upscaler_2 = load_model()
149
 
150
- #fa_processor = FlashAttentionProcessor()
151
 
152
- #for name, module in pipe.transformer.named_modules():
153
  # Only replace processors that are instances of AttnProcessor2_0
154
  # This automatically includes the self-attention and cross-attention within transformer blocks.
155
- # if isinstance(module, AttnProcessor2_0):
156
- # module.processor = fa_processor
157
-
158
 
159
  MAX_SEED = np.iinfo(np.int32).max
160
  MAX_IMAGE_SIZE = 4096
161
 
162
-
163
  @spaces.GPU(duration=45)
164
  def generate_images_30(prompt, neg_prompt_1, neg_prompt_2, neg_prompt_3, width, height, guidance, steps, progress=gr.Progress(track_tqdm=True)):
165
  seed = random.randint(0, MAX_SEED)
 
147
 
148
  pipe, upscaler_2 = load_model()
149
 
150
+ fa_processor = FlashAttentionProcessor()
151
 
152
+ for name, module in pipe.transformer.named_modules():
153
  # Only replace processors that are instances of AttnProcessor2_0
154
  # This automatically includes the self-attention and cross-attention within transformer blocks.
155
+ if isinstance(module, AttnProcessor2_0):
156
+ module.processor = fa_processor
 
157
 
158
  MAX_SEED = np.iinfo(np.int32).max
159
  MAX_IMAGE_SIZE = 4096
160
 
 
161
  @spaces.GPU(duration=45)
162
  def generate_images_30(prompt, neg_prompt_1, neg_prompt_2, neg_prompt_3, width, height, guidance, steps, progress=gr.Progress(track_tqdm=True)):
163
  seed = random.randint(0, MAX_SEED)