Zrelv Claude Opus 4.8 (1M context) commited on
Commit
e8375ff
·
1 Parent(s): 4d46e06

Cap GPU duration reservation at 140s to clear free-tier per-call limit

Browse files

get_inference_duration() returned a padded worst-case (~300-410s); with xlarge
doubling, the reported reservation (312/408s) exceeded free-tier ZeroGPU's ~300s
per-call cap -> 'The requested GPU duration is larger than the maximum allowed'.
Cap total_time at 140 (->~280s reported), which still covers real p90 (~107s)
and the caller's 150s timeout, so generations run at any length.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M4Dr1cMq3pUbTUnXXRs9V1

Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -387,6 +387,13 @@ def get_inference_duration(
387
  if safe_mode:
388
  total_time = total_time * 1.3
389
 
 
 
 
 
 
 
 
390
  return total_time
391
 
392
 
 
387
  if safe_mode:
388
  total_time = total_time * 1.3
389
 
390
+ # Cap the reserved GPU duration so the reported reservation (×2 for xlarge)
391
+ # stays under free-tier ZeroGPU's ~300s per-call limit. The padded worst-case
392
+ # estimate ran 3-10x the real p90 (~107s) and tripped "The requested GPU
393
+ # duration (…) is larger than the maximum allowed". 140 → ~280s reported,
394
+ # still covers p90 and matches the caller's 150s hard timeout. Lower to
395
+ # 130/120 if the cap turns out stricter than 300s.
396
+ total_time = min(total_time, 140)
397
  return total_time
398
 
399