multimodalart HF Staff commited on
Commit
295924c
·
verified ·
1 Parent(s): 8c1d00c

Size GPU duration to measured timings

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -19,6 +19,7 @@ sys.path.insert(0, APP_DIR)
19
  import spaces # noqa: E402 (before torch)
20
 
21
  import json # noqa: E402
 
22
  import random # noqa: E402
23
  import tempfile # noqa: E402
24
  import time # noqa: E402
@@ -120,7 +121,11 @@ def proxy_video(name: str, chunks: int) -> str:
120
 
121
 
122
  def _duration(scene, chunks=8, seed=0, *args, **kwargs):
123
- return int(40 + 14 * int(chunks))
 
 
 
 
124
 
125
 
126
  # --------------------------------------------------------------------------------------------- inference
 
19
  import spaces # noqa: E402 (before torch)
20
 
21
  import json # noqa: E402
22
+ import math # noqa: E402
23
  import random # noqa: E402
24
  import tempfile # noqa: E402
25
  import time # noqa: E402
 
121
 
122
 
123
  def _duration(scene, chunks=8, seed=0, *args, **kwargs):
124
+ """Measured on ZeroGPU xlarge: ~4-6.5 s per chunk while the 6-chunk span fills, 7.6 s once it is full,
125
+ ~1.7 s per chunk of VAE decode + mp4, ~8 s fixed; +15%."""
126
+ n = max(1, min(MAX_CHUNKS, int(chunks)))
127
+ stream = sum(4.0 + 0.5 * k if k < 6 else 7.7 for k in range(n))
128
+ return int(math.ceil(1.15 * (8 + stream + 1.7 * n)))
129
 
130
 
131
  # --------------------------------------------------------------------------------------------- inference