Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions SCHEMA.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,14 @@ variants:
description: "…"
nvfp4: # optional additional variants
model_id: "nvidia/*-NVFP4" # only if the quantized checkpoint is a different HF repo
# hub: modelscope # default: huggingface
precision: nvfp4
vram_minimum_gb: 403
extra_args: ["--kv-cache-dtype", "fp8", "--moe-backend", "flashinfer_cutlass"]

# A variant's hub selects its download source and checkpoint link.
# ModelScope uses a process-wide vLLM setting, including for external drafts.

compatible_strategies: # subset of the 8 strategy ids in strategies/*.yaml
- single_node_tp # always include as baseline
- single_node_tep # for MoE
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"validate": "node --experimental-vm-modules hooks/validate.mjs",
"test:overlay": "node --test scripts/test-overlay.mjs",
"test:schema": "node --test scripts/test-schema.mjs",
"test:hub": "node --test scripts/test-checkpoint-link.mjs scripts/test-model-hubs.mjs",
"test:guide-html": "node --test scripts/test-guide-html.mjs",
"test:dcp": "node --test scripts/test-dcp-selector.mjs",
"test:presets": "node --test scripts/test-presets.mjs",
Expand Down
1 change: 1 addition & 0 deletions public/platform-logos/modelscope.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions scripts/build-recipes-api.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import yaml from "js-yaml";
import Ajv from "ajv";
import { buildRecipeSchema } from "../src/lib/recipe-schema.js";
import { BASELINE, effectivePreset, presetImage, presetPoints, presetSelect, resolvePresetKey, validatePresets, withPreset } from "../src/lib/recipe-presets.js";
import { hasExternalModelReference, hasManualModelScopeEnv } from "../src/lib/checkpoint-link.js";
import { CONTEXT_KINDS, validateContextEntries } from "../src/lib/recipe-context.js";
import {
pickDefaultHardware,
Expand Down Expand Up @@ -603,6 +604,12 @@ let collisionCount = 0;

for (const file of findYamlFiles(modelsDir)) {
const r = normalizeDates(readYaml(file));
if (hasManualModelScopeEnv(r)) {
console.warn(` ⚠ ${sourceRel(file)}: migrate VLLM_USE_MODELSCOPE to the variant's hub field`);
}
if (Object.values(r.variants || {}).some((variant) => variant.hub === "modelscope") && hasExternalModelReference(r)) {
console.warn(` ⚠ ${sourceRel(file)}: ModelScope is process-wide; verify external draft/tokenizer availability`);
}
validateFeatureModes(r, file);
validateFrontends(r, file, taxonomy);
validateHardwareKeys(r, file, taxonomy, strategies);
Expand Down
23 changes: 23 additions & 0 deletions scripts/test-checkpoint-link.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import assert from "node:assert/strict";
import { test } from "node:test";
import { checkpointLink, hasExternalModelReference, hasManualModelScopeEnv } from "../src/lib/checkpoint-link.js";
import { loadTaxonomy } from "../src/lib/taxonomy.js";

const taxonomy = loadTaxonomy();
const recipe = { model: { model_id: "org/base" } };

test("the variant hub determines the checkpoint link", () => {
assert.equal(checkpointLink(recipe, {}, taxonomy).href, "https://huggingface.co/org/base");
assert.deepEqual(checkpointLink(recipe, { model_id: "org/quantized", hub: "modelscope" }, taxonomy), {
modelId: "org/quantized", href: "https://modelscope.cn/models/org/quantized", provider: "ModelScope", hub: "modelscope",
});
assert.equal(checkpointLink({}, {}, taxonomy), null);
assert.equal(checkpointLink(recipe, { hub: "unknown" }, taxonomy), null);
});

test("independent tokenizer and draft references are detected", () => {
assert.equal(hasExternalModelReference({ features: { spec_decoding: { args: ["--speculative-config", '{"method":"mtp"}'] } } }), false);
assert.equal(hasExternalModelReference({ features: { spec_decoding: { args: ["--speculative-config", '{"model":"org/draft"}'] } } }), true);
assert.equal(hasExternalModelReference({ model: { base_args: ["--tokenizer=org/tokenizer"] } }), true);
assert.equal(hasManualModelScopeEnv({ variants: { a: { extra_env: { VLLM_USE_MODELSCOPE: "True" } } } }), true);
});
100 changes: 100 additions & 0 deletions scripts/test-model-hubs.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import assert from "node:assert/strict";
import { test } from "node:test";
import { loadTaxonomy } from "../src/lib/taxonomy.js";
import { loadStrategies } from "../src/lib/strategies.js";
import { resolveCommand, computeDockerMeta, buildDockerRun, buildDockerArgv } from "../src/lib/command-synthesis.js";
import { renderCommand, resolveSelection } from "../src/lib/recipe-render.js";
import { ascendPdPools, ascendPdRecipe } from "./fixtures/ascend-pd.mjs";
import { selectionMarkdown } from "../src/lib/recipe-markdown.js";

const taxonomy = loadTaxonomy();
const strategies = loadStrategies();
const recipe = { hf_id: "org/model", model: { model_id: "org/model" },
variants: { default: { precision: "bf16", vram_minimum_gb: 1 }, ms: { precision: "bf16", vram_minimum_gb: 1, model_id: "org/ms", hub: "modelscope" } },
compatible_strategies: ["single_node_tp", "multi_node_tp", "pd_cluster"] };

test("ModelScope settings follow the variant across workers and Docker forms", () => {
for (const strategy of ["single_node_tp", "multi_node_tp", "pd_cluster"]) {
const result = resolveCommand(recipe, "ms", strategy, "h200", [], strategies, taxonomy, [], 2,
strategy === "pd_cluster" ? { prefill: { nodes: 1 }, decode: { nodes: 1 } } : null);
const roles = strategy === "pd_cluster" ? [result.prefill, result.decode] : [result];
for (const role of roles) assert.equal(role.env.VLLM_USE_MODELSCOPE, "True");
}
const hf = resolveCommand(recipe, "default", "single_node_tp", "h200", [], strategies, taxonomy);
assert.equal(hf.env.VLLM_USE_MODELSCOPE, undefined);
const meta = computeDockerMeta(recipe, recipe.variants.ms, taxonomy.hardware_profiles.h200, "h200", taxonomy);
const env = { VLLM_USE_MODELSCOPE: "True" };
assert.match(buildDockerRun({ command: "vllm serve org/ms", env, ...meta }), /\.cache\/modelscope/);
assert.ok(buildDockerArgv({ argv: ["vllm", "serve", "org/ms"], env, meta }).includes("~/.cache/modelscope:/root/.cache/modelscope"));
const rendered = renderCommand(recipe, "ms", "single_node_tp", "h200", 1, [], strategies, taxonomy);
assert.equal(rendered.hub, "modelscope");
assert.equal(rendered.checkpoint_url, "https://modelscope.cn/models/org/ms");
});

const urls = { page: "https://example.org", json: "https://example.org/json" };

test("JSON and Markdown follow the selected variant and hardware pip path", () => {
const select = (r, key) => {
const result = resolveSelection(r, new URLSearchParams({ hardware: "h200", variant: key }), strategies, taxonomy);
return { install: result.rendering.hub_install, md: selectionMarkdown(r, result, { strategies, taxonomy, urls }) };
};
const hf = select(recipe, "default");
assert.equal(hf.install, undefined);
assert.doesNotMatch(hf.md, /Checkpoint:|pip install.*modelscope/);
const ms = select(recipe, "ms");
assert.equal(ms.install.command, taxonomy.model_hubs.modelscope.install);
assert.match(ms.md, /Checkpoint: \[ModelScope\]\(https:\/\/modelscope\.cn\/models\/org\/ms\)/);
assert.ok(ms.md.includes(ms.install.command));
assert.match(ms.md, /process-wide/);
for (const override of [{ install: { pip: false } }, { hardware_overrides: { h200: { install: { pip: false } } } }]) {
const dockerOnly = structuredClone(recipe);
Object.assign(dockerOnly.variants.ms, override);
const result = select(dockerOnly, "ms");
assert.equal(result.install, undefined);
assert.doesNotMatch(result.md, /pip install.*modelscope/);
}
});

test("every Ascend PD node uses the ModelScope environment and Docker cache", () => {
const r = ascendPdRecipe();
r.variants.default.hub = "modelscope";
const pools = ascendPdPools();
const rendered = renderCommand(r, "default", "pd_cluster", "ascend_950dt", 1, [], strategies, taxonomy,
pools, null, "ascend_pd", undefined, true);
assert.equal(rendered.pd_router, "ascend");
for (const role of ["prefill", "decode"]) {
const nodes = rendered[role].node_commands;
assert.equal(nodes.length, pools[role].nodes);
for (const [rank, node] of nodes.entries()) {
assert.equal(node.node_rank, rank);
assert.equal(node.env.VLLM_USE_MODELSCOPE, "True");
assert.match(node.docker_command, /VLLM_USE_MODELSCOPE=['"]?True/);
assert.ok(node.docker_command.includes(taxonomy.model_hubs.modelscope.cache));
assert.ok(node.docker_argv.includes("VLLM_USE_MODELSCOPE=True"));
assert.ok(node.docker_argv.includes(taxonomy.model_hubs.modelscope.cache));
}
}
});

test("the selected PD router and adjustment report the ModelScope fallback", () => {
for (const router of ["dynamo", "smg"]) {
const query = new URLSearchParams({ hardware: "h200", variant: "ms", strategy: "pd_cluster", pd_router: router });
const { rendering, selection } = resolveSelection(recipe, query, strategies, taxonomy);
const reason = taxonomy.model_hubs.modelscope.unsupported_routers[router];
assert.equal(rendering.pd_router, "vllm");
assert.equal(rendering.router_unavailable_reason, reason);
assert.equal(selection.pd_router, "vllm");
assert.deepEqual(selection.adjusted.find(({ param }) => param === "pd_router"),
{ param: "pd_router", requested: router, used: "vllm", reason });
}
});

test("a non-hub SMG fallback also reports the router adjustment", () => {
const noSmg = { ...strategies, pd_cluster: { ...strategies.pd_cluster, smg: null } };
const query = new URLSearchParams({ hardware: "h200", variant: "default", strategy: "pd_cluster", pd_router: "smg" });
const { rendering, selection } = resolveSelection(recipe, query, noSmg, taxonomy);
assert.match(rendering.router_unavailable_reason, /SMG is not configured/);
assert.deepEqual(selection.adjusted.find(({ param }) => param === "pd_router"), {
param: "pd_router", requested: "smg", used: "vllm", reason: rendering.router_unavailable_reason,
});
});
6 changes: 6 additions & 0 deletions scripts/test-schema.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ test("misspelled keys are rejected", () => {
assert.ok(errorsFor((r) => { r.features.tool_calling.arg = ["--x"]; }).length);
});

test("hub is a known variant-level value", () => {
assert.deepEqual(errorsFor((r) => { r.variants.default.hub = "modelscope"; }), []);
assert.ok(errorsFor((r) => { r.variants.default.hub = "unknown"; }).length);
assert.ok(errorsFor((r) => { r.model.hub = "modelscope"; }).length);
});

test("vocabulary and status values are checked", () => {
assert.ok(errorsFor((r) => { r.variants.default.supported_frontends = ["go"]; }).length);
assert.ok(errorsFor((r) => { r.meta.hardware.h999 = "verified"; }).length);
Expand Down
8 changes: 7 additions & 1 deletion src/components/icons/PlatformLogos.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Brand marks served from public/platform-logos/ as static SVG files.
// Sources: HuggingFace from Iconify (logos:hugging-face-icon), Modal from
// Sources: HuggingFace from Iconify (logos:hugging-face-icon), ModelScope from
// LobeHub Icons (MIT), Modal from
// modal.com's official favicon, AWS from devicon. SageMaker reuses the AWS
// mark since no SageMaker-specific brand glyph exists; the wordmark color is
// theme-swapped because the original navy ink vanishes on dark backgrounds.
Expand All @@ -9,6 +10,11 @@ export function HuggingFaceIcon({ className = "" }) {
return <img src="/platform-logos/huggingface.svg" alt="" aria-hidden="true" className={className} />;
}

export function ModelScopeIcon({ className = "" }) {
// eslint-disable-next-line @next/next/no-img-element
return <img src="/platform-logos/modelscope.svg" alt="" aria-hidden="true" className={className} />;
}

function ModalIcon({ className = "" }) {
// eslint-disable-next-line @next/next/no-img-element
return <img src="/platform-logos/modal.svg" alt="Modal" className={className} />;
Expand Down
Loading
Loading