victor HF Staff commited on
Commit
3901f50
·
1 Parent(s): 9f3065c

Fix startup crash by wrapping optimization in try-except

Browse files
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -52,15 +52,18 @@ pipe.to("cuda")
52
 
53
  pipe.transformer.set_attention_backend("_flash_3_hub")
54
 
55
- optimize_pipeline_(
56
- pipe,
57
- image=[Image.new("RGB", (1024, 1024))],
58
- prompt_embeds=remote_text_encoder("prompt").to("cuda"),
59
- guidance_scale=2.5,
60
- width=1024,
61
- height=1024,
62
- num_inference_steps=1,
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(