multimodalart HF Staff commited on
Commit
20ade0d
verified
1 Parent(s): ef045eb

Size ZeroGPU duration from measured 1.89 s/step + 3 s fixed

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -120,8 +120,11 @@ MAX_SEED = 2**31 - 1
120
  DEFAULT_SEED = 20260508
121
 
122
 
123
- STEP_SECONDS = 5.0 # replaced with the measured per-step cost after smoke test
124
- BASE_SECONDS = 45.0 # text encode + VAE decode + mux
 
 
 
125
 
126
 
127
  def _duration(*args, **kwargs):
@@ -137,7 +140,7 @@ def _duration(*args, **kwargs):
137
  steps = int(steps)
138
  except (TypeError, ValueError):
139
  steps = 50
140
- return int(min(900, BASE_SECONDS + STEP_SECONDS * steps))
141
 
142
 
143
  @spaces.GPU(duration=_duration)
@@ -254,7 +257,7 @@ with gr.Blocks() as demo:
254
  than dubbed afterwards.
255
 
256
  Output is the checkpoint's native resolution: **121 frames 路 256x256 路 24 fps 路
257
- 48 kHz audio (~5 s)**. A run takes a few minutes.
258
  """
259
  )
260
 
 
120
  DEFAULT_SEED = 20260508
121
 
122
 
123
+ # Measured on this Space's zero-a10g: 20 steps -> 40.9 s, 50 steps -> 97.6 s
124
+ # wall inside `generate` => ~1.89 s/step plus ~3 s fixed (text encode, VAE
125
+ # decode of 121 frames, WAV write, ffmpeg mux). Sized with a ~15-20% margin.
126
+ STEP_SECONDS = 2.2
127
+ BASE_SECONDS = 5.0
128
 
129
 
130
  def _duration(*args, **kwargs):
 
140
  steps = int(steps)
141
  except (TypeError, ValueError):
142
  steps = 50
143
+ return int(min(300, BASE_SECONDS + STEP_SECONDS * steps))
144
 
145
 
146
  @spaces.GPU(duration=_duration)
 
257
  than dubbed afterwards.
258
 
259
  Output is the checkpoint's native resolution: **121 frames 路 256x256 路 24 fps 路
260
+ 48 kHz audio (~5 s)**. A default 50-step run takes about 1.5 minutes.
261
  """
262
  )
263