models on tracker
This commit is contained in:
@@ -106,6 +106,11 @@ def _resolve_model_flags(
|
||||
explicit = model_id or model
|
||||
if not explicit:
|
||||
return None, None
|
||||
from .model_catalog import resolve_model_alias
|
||||
|
||||
preset = resolve_model_alias(explicit)
|
||||
if preset is not None:
|
||||
return preset.name, preset.hf_repo
|
||||
if "/" in explicit:
|
||||
return explicit.split("/")[-1], explicit
|
||||
return explicit, None
|
||||
|
||||
@@ -19,6 +19,7 @@ class ModelPreset:
|
||||
vram_bf16: float
|
||||
description: str
|
||||
metadata: dict | None = None
|
||||
aliases: tuple[str, ...] = ()
|
||||
|
||||
def vram_for_quant(self, quant: str) -> float:
|
||||
"""Return VRAM requirement in GB for the given quantization."""
|
||||
@@ -167,9 +168,29 @@ CURATED_MODELS: list[ModelPreset] = [
|
||||
description="Large coding-focused MoE model",
|
||||
metadata=_MODEL_METADATA.get("unsloth/Kimi-K2.7-Code"),
|
||||
),
|
||||
ModelPreset(
|
||||
name="Qwen3.6-27B",
|
||||
hf_repo="Qwen/Qwen3.6-27B",
|
||||
num_layers=64,
|
||||
vram_nf4=13.0,
|
||||
vram_int8=26.0,
|
||||
vram_bf16=52.0,
|
||||
description="Qwen 27B hybrid linear-attention model",
|
||||
aliases=("qwen3.6-27b",),
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
def resolve_model_alias(value: str) -> ModelPreset | None:
|
||||
"""Resolve a curated name, repository, or alias case-insensitively."""
|
||||
normalized = value.strip().casefold()
|
||||
for model in CURATED_MODELS:
|
||||
candidates = (model.name, model.hf_repo, *model.aliases)
|
||||
if normalized in {candidate.casefold() for candidate in candidates}:
|
||||
return model
|
||||
return None
|
||||
|
||||
|
||||
def layers_from_config(cfg) -> int | None:
|
||||
"""Extract the transformer layer count from a HuggingFace config object.
|
||||
|
||||
|
||||
@@ -631,6 +631,21 @@ def _registration_display_fields(node_name: str | None) -> dict[str, str]:
|
||||
return {"friendly_name": name}
|
||||
|
||||
|
||||
def _tracker_http_error_message(exc: urllib.error.HTTPError) -> str:
|
||||
"""Describe an HTTP rejection from the tracker, including its JSON error."""
|
||||
detail = exc.reason or "request rejected"
|
||||
try:
|
||||
payload = json.loads(exc.read().decode("utf-8", errors="replace"))
|
||||
error = payload.get("error") if isinstance(payload, dict) else None
|
||||
if isinstance(error, dict):
|
||||
detail = error.get("message") or error.get("code") or detail
|
||||
elif error:
|
||||
detail = error
|
||||
except Exception:
|
||||
pass
|
||||
return f"Tracker rejected shard assignment (HTTP {exc.code}): {detail}"
|
||||
|
||||
|
||||
def run_startup(
|
||||
tracker_url: str,
|
||||
port: int = 0,
|
||||
@@ -1108,6 +1123,8 @@ def run_startup(
|
||||
})
|
||||
try:
|
||||
assignment = _get_json(f"{tracker_url}/v1/nodes/assign?{assign_qs}")
|
||||
except urllib.error.HTTPError as exc:
|
||||
raise RuntimeError(_tracker_http_error_message(exc)) from exc
|
||||
except urllib.error.URLError as exc:
|
||||
print(f" ERROR: Cannot reach tracker at {tracker_url}: {exc}", file=sys.stderr, flush=True)
|
||||
raise
|
||||
|
||||
Reference in New Issue
Block a user