Spaces:
Running on Zero
Running on Zero
Guard _install_cuda_packages() startup call against quota exhaustion
Browse filesIf ZeroGPU quota is exhausted at startup, the @spaces.GPU decorator
throws β previously this crashed module import causing RUNTIME_ERROR.
Now wrapped in try/except so the app stays alive; CUDA extensions will
be unavailable but each GPU-decorated function handles that gracefully.
app.py
CHANGED
|
@@ -210,7 +210,12 @@ def _install_cuda_packages():
|
|
| 210 |
_CUDA_PKG_MARKER.touch()
|
| 211 |
print("[startup] CUDA packages installed.")
|
| 212 |
|
| 213 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
# ββ Paths βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 215 |
HERE = Path(__file__).parent
|
| 216 |
PIPELINE_DIR = HERE / "pipeline"
|
|
|
|
| 210 |
_CUDA_PKG_MARKER.touch()
|
| 211 |
print("[startup] CUDA packages installed.")
|
| 212 |
|
| 213 |
+
try:
|
| 214 |
+
_install_cuda_packages()
|
| 215 |
+
except Exception as _e:
|
| 216 |
+
# Quota exhaustion or GPU unavailable at startup β CUDA extensions may be missing,
|
| 217 |
+
# but don't crash the app. Each GPU-decorated function will handle missing imports.
|
| 218 |
+
print(f"[startup] WARNING: _install_cuda_packages failed ({type(_e).__name__}): {_e}")
|
| 219 |
# ββ Paths βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 220 |
HERE = Path(__file__).parent
|
| 221 |
PIPELINE_DIR = HERE / "pipeline"
|