ovi054 commited on
Commit
c97e3d8
·
verified ·
1 Parent(s): c984ecc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import torch
2
  from diffusers import UniPCMultistepScheduler
3
  from diffusers import WanPipeline, AutoencoderKLWan # Use Wan-specific VAE
 
4
  from diffusers.models import UNetSpatioTemporalConditionModel
5
  from transformers import T5EncoderModel, T5Tokenizer
6
 
@@ -23,6 +24,7 @@ def generate(prompt, negative_prompt, width=1024, height=1024, num_inference_ste
23
  pipe.unload_lora_weights()
24
  pipe.load_lora_weights(lora_id.strip())
25
  pipe.to("cuda")
 
26
  try:
27
  output = pipe(
28
  prompt=prompt,
 
1
  import torch
2
  from diffusers import UniPCMultistepScheduler
3
  from diffusers import WanPipeline, AutoencoderKLWan # Use Wan-specific VAE
4
+ from diffusers.hooks import apply_first_block_cache, FirstBlockCacheConfig
5
  from diffusers.models import UNetSpatioTemporalConditionModel
6
  from transformers import T5EncoderModel, T5Tokenizer
7
 
 
24
  pipe.unload_lora_weights()
25
  pipe.load_lora_weights(lora_id.strip())
26
  pipe.to("cuda")
27
+ apply_first_block_cache(pipe.transformer, FirstBlockCacheConfig(threshold=0.2))
28
  try:
29
  output = pipe(
30
  prompt=prompt,