Oysiyl Claude Sonnet 4.5 commited on
Commit
d8f6a5a
·
1 Parent(s): 82b2bf3

Increase zero GPU timeout by 10% to prevent user timeouts

Browse files

Updated all dynamic duration calculations with additional 10% buffer:
- Standard pipeline: 32% safety margin (was 20%)
- Artistic pipeline: 37.5% safety margin (was 25%)

This ensures users have sufficient time to complete generations across all configurations.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +13 -13
app.py CHANGED
@@ -579,7 +579,7 @@ def compile_models_with_aoti():
579
 
580
  def get_dynamic_duration(*args, **kwargs):
581
  """
582
- Calculate GPU duration based on benchmarks with 20-25% safety margin.
583
  Max duration capped at 120s (unauthenticated user limit).
584
 
585
  Benchmarks (actual measured times):
@@ -600,32 +600,32 @@ def get_dynamic_duration(*args, **kwargs):
600
  print(f"[GPU DURATION DEBUG] Extracted: pipeline={pipeline}, image_size={image_size}, enable_animation={enable_animation}, enable_upscale={enable_upscale}")
601
 
602
  if pipeline == "standard":
603
- # Standard pipeline benchmarks (with 20% safety margin)
604
  if image_size <= 512:
605
- duration = 12 if enable_animation else 9
606
  elif image_size <= 640:
607
- duration = 18 if enable_animation else 13
608
  elif image_size <= 768:
609
- duration = 22 if enable_animation else 16
610
  elif image_size <= 832:
611
- duration = 24 if enable_animation else 17
612
  else: # 1024
613
- duration = 48 if enable_animation else 34
614
  else: # artistic
615
- # Artistic pipeline benchmarks (with 25% safety margin)
616
  if image_size <= 512:
617
  # Extrapolated from 640 benchmark (~18s base)
618
- duration = 22 if not enable_upscale else 38
619
  elif image_size <= 640:
620
- duration = 28 if not enable_upscale else 50
621
  elif image_size <= 768:
622
  # Interpolated between 640 and 832 (~35s base)
623
- duration = 44 if not enable_upscale else 65
624
  elif image_size <= 832:
625
- duration = 56 if not enable_upscale else 72
626
  else: # 1024
627
  # Extrapolated from 832 (~75s base)
628
- duration = 94 if not enable_upscale else 120 # Worst case measured at 124s
629
 
630
  # Cap at 120 seconds (unauthenticated user limit)
631
  final_duration = min(duration, 120)
 
579
 
580
  def get_dynamic_duration(*args, **kwargs):
581
  """
582
+ Calculate GPU duration based on benchmarks with 32-37.5% safety margin (+10% buffer).
583
  Max duration capped at 120s (unauthenticated user limit).
584
 
585
  Benchmarks (actual measured times):
 
600
  print(f"[GPU DURATION DEBUG] Extracted: pipeline={pipeline}, image_size={image_size}, enable_animation={enable_animation}, enable_upscale={enable_upscale}")
601
 
602
  if pipeline == "standard":
603
+ # Standard pipeline benchmarks (with 32% safety margin = 20% + 10% buffer)
604
  if image_size <= 512:
605
+ duration = 13 if enable_animation else 10
606
  elif image_size <= 640:
607
+ duration = 20 if enable_animation else 14
608
  elif image_size <= 768:
609
+ duration = 24 if enable_animation else 18
610
  elif image_size <= 832:
611
+ duration = 26 if enable_animation else 19
612
  else: # 1024
613
+ duration = 53 if enable_animation else 37
614
  else: # artistic
615
+ # Artistic pipeline benchmarks (with 37.5% safety margin = 25% + 10% buffer)
616
  if image_size <= 512:
617
  # Extrapolated from 640 benchmark (~18s base)
618
+ duration = 24 if not enable_upscale else 42
619
  elif image_size <= 640:
620
+ duration = 31 if not enable_upscale else 55
621
  elif image_size <= 768:
622
  # Interpolated between 640 and 832 (~35s base)
623
+ duration = 48 if not enable_upscale else 72
624
  elif image_size <= 832:
625
+ duration = 62 if not enable_upscale else 79
626
  else: # 1024
627
  # Extrapolated from 832 (~75s base)
628
+ duration = 103 if not enable_upscale else 132 # Worst case measured at 124s
629
 
630
  # Cap at 120 seconds (unauthenticated user limit)
631
  final_duration = min(duration, 120)