Fix ZeroGPU startup: skip RAM watchdog on Space (psutil misreports in container); add packages.txt (sox/ffmpeg)
Browse files- app.py +12 -5
- packages.txt +3 -0
app.py
CHANGED
|
@@ -32,22 +32,29 @@ NONE_VOICE = "— none —"
|
|
| 32 |
LANG_CHOICES = list(config.LANGUAGES.keys())
|
| 33 |
SPEAKER_CHOICES = [(f"{s.display} — {s.description.rstrip('.')} ({s.language})", s.key) for s in config.SPEAKERS]
|
| 34 |
|
| 35 |
-
#
|
| 36 |
-
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
|
| 40 |
# ---- helpers -----------------------------------------------------------------
|
| 41 |
def meter_html() -> str:
|
| 42 |
-
snap = snapshot()
|
| 43 |
if MGR.info:
|
| 44 |
state = "on" if MGR.info.enabled else "off"
|
| 45 |
lora = f' · LoRA <b>{MGR.info.source.split("/")[-1]}</b> ({state})'
|
| 46 |
else:
|
| 47 |
lora = ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
return (
|
| 49 |
f'<div class="qvs-meter">DEVICE <b>{target_device()}</b> · DTYPE <b>bf16</b> · '
|
| 50 |
-
f'ATTN <b>{get_attn_impl()}</b> ·
|
| 51 |
f'RESIDENT <b>{len(REG.loaded)}</b>/3{lora}</div>'
|
| 52 |
)
|
| 53 |
|
|
|
|
| 32 |
LANG_CHOICES = list(config.LANGUAGES.keys())
|
| 33 |
SPEAKER_CHOICES = [(f"{s.display} — {s.description.rstrip('.')} ({s.language})", s.key) for s in config.SPEAKERS]
|
| 34 |
|
| 35 |
+
# RAM watchdog protects the local macOS gate (DESIGN §6). On ZeroGPU the
|
| 36 |
+
# constraint is the 48 GB card, not container RAM (where psutil misreports),
|
| 37 |
+
# so the RAM guard is disabled there.
|
| 38 |
+
if not on_zerogpu():
|
| 39 |
+
MemoryGuard(hard_gb=float(os.environ.get("QVS_MEMGUARD_HARD", "76")),
|
| 40 |
+
soft_gb=float(os.environ.get("QVS_MEMGUARD_SOFT", "72"))).start()
|
| 41 |
|
| 42 |
|
| 43 |
# ---- helpers -----------------------------------------------------------------
|
| 44 |
def meter_html() -> str:
|
|
|
|
| 45 |
if MGR.info:
|
| 46 |
state = "on" if MGR.info.enabled else "off"
|
| 47 |
lora = f' · LoRA <b>{MGR.info.source.split("/")[-1]}</b> ({state})'
|
| 48 |
else:
|
| 49 |
lora = ""
|
| 50 |
+
if on_zerogpu():
|
| 51 |
+
mem = "MEM <b>ZeroGPU</b>" # container RAM is not the constraint here
|
| 52 |
+
else:
|
| 53 |
+
snap = snapshot()
|
| 54 |
+
mem = f"MEM <b>{snap.committed:.0f}</b>/{snap.total:.0f} GB"
|
| 55 |
return (
|
| 56 |
f'<div class="qvs-meter">DEVICE <b>{target_device()}</b> · DTYPE <b>bf16</b> · '
|
| 57 |
+
f'ATTN <b>{get_attn_impl()}</b> · {mem} · '
|
| 58 |
f'RESIDENT <b>{len(REG.loaded)}</b>/3{lora}</div>'
|
| 59 |
)
|
| 60 |
|
packages.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
sox
|
| 2 |
+
libsox-fmt-all
|
| 3 |
+
ffmpeg
|