Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import torch
|
| 2 |
from diffusers import UniPCMultistepScheduler
|
| 3 |
from diffusers import WanPipeline, AutoencoderKLWan # Use Wan-specific VAE
|
| 4 |
-
|
| 5 |
from diffusers.models import UNetSpatioTemporalConditionModel
|
| 6 |
from transformers import T5EncoderModel, T5Tokenizer
|
| 7 |
|
|
@@ -24,7 +24,7 @@ def generate(prompt, negative_prompt, width=1024, height=1024, num_inference_ste
|
|
| 24 |
pipe.unload_lora_weights()
|
| 25 |
pipe.load_lora_weights(lora_id.strip())
|
| 26 |
pipe.to("cuda")
|
| 27 |
-
|
| 28 |
try:
|
| 29 |
output = pipe(
|
| 30 |
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,
|