Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Commit ·
33fcfe5
1
Parent(s): 6c5b707
Fix moshi resolution and requirement lines in saved setup scripts
Browse files- Kyutai/moshi streaming jobs use the huggingface-hub<1.0 core: every moshi
release pins hub<1.0, which conflicted with the default hub>=1.14.
- Dispatch moves requirement lines (numpy>2.0.0) out of a saved setup script
into extra requirements, so retrying an older job no longer fails with exit 127.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- job_queue.py +18 -1
- remote_jobs.py +6 -2
job_queue.py
CHANGED
|
@@ -200,6 +200,17 @@ _REQUIREMENT_LINE_RE = re.compile(
|
|
| 200 |
)
|
| 201 |
|
| 202 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
def sanitize_setup_script(text: str) -> str:
|
| 204 |
"""Trim and cap one-time setup script (shell or Python) for storage.
|
| 205 |
|
|
@@ -209,7 +220,7 @@ def sanitize_setup_script(text: str) -> str:
|
|
| 209 |
s = (text or "").strip()
|
| 210 |
if not s:
|
| 211 |
return ""
|
| 212 |
-
reqs =
|
| 213 |
if reqs:
|
| 214 |
raise ValueError(
|
| 215 |
f"the setup script contains a Python requirement ({reqs[0]!r}). "
|
|
@@ -1389,6 +1400,12 @@ def _remote_dispatch_job(job_id: str, mid: str, fid: str, jobs_token: str) -> st
|
|
| 1389 |
allow_remote = bool(j_dispatch and j_dispatch.allow_remote_code)
|
| 1390 |
hardware_flavor = (j_dispatch.hardware_flavor or "") if j_dispatch else ""
|
| 1391 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1392 |
info = remote_jobs.submit_eval_job(
|
| 1393 |
model_id=mid,
|
| 1394 |
family_id=fid,
|
|
|
|
| 200 |
)
|
| 201 |
|
| 202 |
|
| 203 |
+
def split_setup_requirements(setup: str) -> tuple[str, list[str]]:
|
| 204 |
+
"""``(setup script without requirement lines, those requirement lines)``."""
|
| 205 |
+
keep, reqs = [], []
|
| 206 |
+
for ln in (setup or "").splitlines():
|
| 207 |
+
if _REQUIREMENT_LINE_RE.match(ln.strip()):
|
| 208 |
+
reqs.append(ln.strip())
|
| 209 |
+
else:
|
| 210 |
+
keep.append(ln)
|
| 211 |
+
return "\n".join(keep).strip(), reqs
|
| 212 |
+
|
| 213 |
+
|
| 214 |
def sanitize_setup_script(text: str) -> str:
|
| 215 |
"""Trim and cap one-time setup script (shell or Python) for storage.
|
| 216 |
|
|
|
|
| 220 |
s = (text or "").strip()
|
| 221 |
if not s:
|
| 222 |
return ""
|
| 223 |
+
_rest, reqs = split_setup_requirements(s)
|
| 224 |
if reqs:
|
| 225 |
raise ValueError(
|
| 226 |
f"the setup script contains a Python requirement ({reqs[0]!r}). "
|
|
|
|
| 1400 |
allow_remote = bool(j_dispatch and j_dispatch.allow_remote_code)
|
| 1401 |
hardware_flavor = (j_dispatch.hardware_flavor or "") if j_dispatch else ""
|
| 1402 |
|
| 1403 |
+
# Jobs saved before setup scripts were checked can hold a requirement line (``numpy>2.0.0``),
|
| 1404 |
+
# which fails as shell; install it as a requirement instead.
|
| 1405 |
+
setup_script, moved = split_setup_requirements(setup_script)
|
| 1406 |
+
if moved:
|
| 1407 |
+
extra_req = "\n".join([*parse_requirements_lines(extra_req), *moved])
|
| 1408 |
+
|
| 1409 |
info = remote_jobs.submit_eval_job(
|
| 1410 |
model_id=mid,
|
| 1411 |
family_id=fid,
|
remote_jobs.py
CHANGED
|
@@ -486,8 +486,12 @@ def _select_streaming_deps(model_id: str, *, run_custom_script: bool) -> list[st
|
|
| 486 |
env_extras = _parse_extra_deps_env()
|
| 487 |
if run_custom_script:
|
| 488 |
return _dedupe([*_custom_script_core_deps(), *env_extras])
|
| 489 |
-
|
| 490 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 491 |
|
| 492 |
|
| 493 |
def _select_deps(
|
|
|
|
| 486 |
env_extras = _parse_extra_deps_env()
|
| 487 |
if run_custom_script:
|
| 488 |
return _dedupe([*_custom_script_core_deps(), *env_extras])
|
| 489 |
+
family = sc.resolve_family(model_id)
|
| 490 |
+
# Every moshi release pins huggingface-hub<1.0: use the hub-compat core (bucket I/O then runs
|
| 491 |
+
# in storage's isolated uv env, as for the qwen-asr stack).
|
| 492 |
+
core = _core_deps(qwen_stack=family == sc.MOSHI)
|
| 493 |
+
extras = _filter_uv_extra_lines(env_extras, qwen_stack=family == sc.MOSHI, recipe_id=None)
|
| 494 |
+
return _dedupe([*core, *streaming_stack(family), *extras])
|
| 495 |
|
| 496 |
|
| 497 |
def _select_deps(
|