Spaces:
Running on Zero
Running on Zero
Drop the length cap on the audio, keeping the reservation sized to it
Browse filesThe model works through it in segments or chunks, so its length costs time rather than memory. ZeroGPU already refuses a request that the caller's tier or remaining allowance cannot cover, before reserving anything, and tells a free account how to get more. A cap set so that a free account could afford every request therefore only turned away callers who could. The only request refused here now is one whose reservation would outlast PyHARP's 15 minute timeout, which would stop it anyway.
app.py
CHANGED
|
@@ -109,8 +109,10 @@ model_card = ModelCard(
|
|
| 109 |
|
| 110 |
# The audio is upsampled in 15-second chunks that start 13 seconds apart, each at the number of
|
| 111 |
# DDIM steps asked for, so the cost grows with both
|
| 112 |
-
|
| 113 |
-
|
|
|
|
|
|
|
| 114 |
|
| 115 |
|
| 116 |
def gpu_seconds(input_audio_path: str, ddim_steps: int, guidance_scale: float, seed: int) -> float:
|
|
@@ -129,10 +131,6 @@ def process_fn(input_audio_path: str, ddim_steps: int, guidance_scale: float, se
|
|
| 129 |
info = sf.info(input_audio_path)
|
| 130 |
except Exception as exc:
|
| 131 |
raise gr.Error(f"Could not read the audio file: {exc}") from exc
|
| 132 |
-
if info.duration > MAX_INPUT_SECONDS:
|
| 133 |
-
raise gr.Error(
|
| 134 |
-
f"The audio is {info.duration:.1f} s long. Trim it to {MAX_INPUT_SECONDS} seconds or less."
|
| 135 |
-
)
|
| 136 |
if gpu_seconds(input_audio_path, ddim_steps, guidance_scale, 0) > MAX_GPU_SECONDS:
|
| 137 |
raise gr.Error(
|
| 138 |
f"{int(ddim_steps)} DDIM steps on {info.duration:.0f} s of audio need more GPU time than "
|
|
|
|
| 109 |
|
| 110 |
# The audio is upsampled in 15-second chunks that start 13 seconds apart, each at the number of
|
| 111 |
# DDIM steps asked for, so the cost grows with both
|
| 112 |
+
# PyHARP stops a job that runs past its timeout_s, 15 minutes by default, so a request whose
|
| 113 |
+
# reservation would exceed that is refused rather than started. A shorter one is left to
|
| 114 |
+
# ZeroGPU, which admits it when the caller's own allowance covers it.
|
| 115 |
+
MAX_GPU_SECONDS = 900
|
| 116 |
|
| 117 |
|
| 118 |
def gpu_seconds(input_audio_path: str, ddim_steps: int, guidance_scale: float, seed: int) -> float:
|
|
|
|
| 131 |
info = sf.info(input_audio_path)
|
| 132 |
except Exception as exc:
|
| 133 |
raise gr.Error(f"Could not read the audio file: {exc}") from exc
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
if gpu_seconds(input_audio_path, ddim_steps, guidance_scale, 0) > MAX_GPU_SECONDS:
|
| 135 |
raise gr.Error(
|
| 136 |
f"{int(ddim_steps)} DDIM steps on {info.duration:.0f} s of audio need more GPU time than "
|