techfreakworm commited on
Commit
c8552a7
·
unverified ·
1 Parent(s): 794009c

Fix ZeroGPU startup: skip RAM watchdog on Space (psutil misreports in container); add packages.txt (sox/ffmpeg)

Browse files
Files changed (2) hide show
  1. app.py +12 -5
  2. 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
- # Watchdog is active in every model-touching run (DESIGN §6).
36
- MemoryGuard(hard_gb=float(os.environ.get("QVS_MEMGUARD_HARD", "76")),
37
- soft_gb=float(os.environ.get("QVS_MEMGUARD_SOFT", "72"))).start()
 
 
 
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> · MEM <b>{snap.committed:.0f}</b>/{snap.total:.0f} GB · '
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