Spaces:
Running
on
Zero
Running
on
Zero
Fix startup crash by wrapping optimization in try-except
Browse files
app.py
CHANGED
|
@@ -52,15 +52,18 @@ pipe.to("cuda")
|
|
| 52 |
|
| 53 |
pipe.transformer.set_attention_backend("_flash_3_hub")
|
| 54 |
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
def get_duration(
|
|
|
|
| 52 |
|
| 53 |
pipe.transformer.set_attention_backend("_flash_3_hub")
|
| 54 |
|
| 55 |
+
try:
|
| 56 |
+
optimize_pipeline_(
|
| 57 |
+
pipe,
|
| 58 |
+
image=[Image.new("RGB", (1024, 1024))],
|
| 59 |
+
prompt_embeds=remote_text_encoder("prompt").to("cuda"),
|
| 60 |
+
guidance_scale=2.5,
|
| 61 |
+
width=1024,
|
| 62 |
+
height=1024,
|
| 63 |
+
num_inference_steps=1,
|
| 64 |
+
)
|
| 65 |
+
except Exception as e:
|
| 66 |
+
print(f"Optimization failed: {e}")
|
| 67 |
|
| 68 |
|
| 69 |
def get_duration(
|