Spaces:
Running on Zero
Running on Zero
tighten ZeroGPU duration to measured latency (~1s/step/window)
Browse files
app.py
CHANGED
|
@@ -413,10 +413,17 @@ def _write_mp4(frames_u8: np.ndarray, fps: int = 15) -> str:
|
|
| 413 |
|
| 414 |
|
| 415 |
def _estimate_duration(*a, **k):
|
| 416 |
-
"""ZeroGPU reservation
|
| 417 |
-
|
| 418 |
-
steps
|
| 419 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 420 |
|
| 421 |
|
| 422 |
@spaces.GPU(duration=_estimate_duration)
|
|
|
|
| 413 |
|
| 414 |
|
| 415 |
def _estimate_duration(*a, **k):
|
| 416 |
+
"""ZeroGPU reservation, fitted to latency measured on this Space.
|
| 417 |
+
|
| 418 |
+
Client-side end-to-end at 20 sampler steps: 1 window 28.6 s, 2 windows 50.6 s,
|
| 419 |
+
3 windows 67.2 s -> ~1.0 s per sampler step per window, plus ~12 s of scene
|
| 420 |
+
prep, VAE encode/decode and mp4 muxing. Keeps ~20% headroom, no more.
|
| 421 |
+
"""
|
| 422 |
+
rounds = int(a[10]) if len(a) > 10 else int(k.get("rollout_rounds", 2))
|
| 423 |
+
steps = int(a[11]) if len(a) > 11 else int(k.get("num_steps", 20))
|
| 424 |
+
rounds = max(1, min(rounds, 3))
|
| 425 |
+
steps = max(1, min(steps, 40))
|
| 426 |
+
return int(min(180, 12 + rounds * (4 + steps * 1.0)))
|
| 427 |
|
| 428 |
|
| 429 |
@spaces.GPU(duration=_estimate_duration)
|