fuzeey commited on
Commit
ab9978e
·
1 Parent(s): 2a96209

Fix Sentence Transformers Hub lists and show retrieval validation details

Browse files
Files changed (1) hide show
  1. app.js +19 -4
app.js CHANGED
@@ -97,6 +97,8 @@ function hubList(library, task, name, view, count) {
97
  const sort = HUB_SORTS[view];
98
  if (!hubLists.has(key)) {
99
  const query = new URLSearchParams({ library, sort, direction: "-1", limit: PAGE });
 
 
100
  if (task) query.set("pipeline_tag", task);
101
  if (name) query.set("search", name);
102
  for (const field of [sort, "safetensors", "library_name"]) query.append("expand[]", field);
@@ -107,9 +109,10 @@ function hubList(library, task, name, view, count) {
107
  while (list.models.length < count && list.next) {
108
  const response = await fetchOk(list.next);
109
  list.models.push(...(await response.json())
110
- // The Hub's library filter matches a tag that models of other libraries
111
- // carry too, such as diffusers' FLUX or sentence-transformers' MiniLM.
112
- .filter((model) => model.library_name === library)
 
113
  .map((model) => ({ id: model.id, score: model[sort] ?? 0, params: model.safetensors?.total })));
114
  list.next = response.headers.get("Link")?.match(/<([^>]+)>;\s*rel="next"/)?.[1];
115
  }
@@ -215,6 +218,11 @@ async function renderPanel() {
215
  select(active, "version", versionsOf(s.sdk)),
216
  nameField),
217
  ...(selected ? [h("p", { class: "pair" }, `neuronx-cc ${latest.sdk} · ${active} ${latest.version}`)] : [tasks]),
 
 
 
 
 
218
  results);
219
 
220
  let runs, rank, exclusions, taskList;
@@ -343,13 +351,20 @@ function showRun(run) {
343
  h("p", {}, `${badge(run.result)} · ${run.neuron_cores} NeuronCore${run.neuron_cores > 1 ? "s" : ""}`
344
  + ` · ${run.runner} · ${run.library} ${run.library_version}`
345
  + ` · tested ${day(run.tested_at)}`),
 
 
 
 
 
 
 
346
  h("h3", {}, "Run it"),
347
  h("p", {}, `On a ${TARGETS[target]?.name ?? target} (${target}) instance with this Neuron stack,`
348
  + " for example in the AWS Neuron Deep Learning Container:"),
349
  h("dl", {}, stack.map(([name, version]) => [h("dt", {}, name), h("dd", {}, h("code", {}, version))])),
350
  h("ol", {},
351
  pip && h("li", {}, "Install the packages the script adds:", h("pre", {}, pip)),
352
- h("li", {}, "Optionally, skip compilation with the graphs this compiler already built:",
353
  h("pre", {}, `hf buckets sync ${NEFF_CACHE}/${target}/neuronxcc-${run.neuronx_cc} /tmp/neff_cache`)),
354
  h("li", {}, "Download ", h("a", { href: scriptUrl, download: "run.py" }, "run.py"), " and run it",
355
  run.neuron_cores > 1 ? ". It launches its own torch.distributed ranks:" : ":",
 
97
  const sort = HUB_SORTS[view];
98
  if (!hubLists.has(key)) {
99
  const query = new URLSearchParams({ library, sort, direction: "-1", limit: PAGE });
100
+ // The model API uses filter for library tags; library alone is ignored.
101
+ if (library === "sentence-transformers") query.set("filter", library);
102
  if (task) query.set("pipeline_tag", task);
103
  if (name) query.set("search", name);
104
  for (const field of [sort, "safetensors", "library_name"]) query.append("expand[]", field);
 
109
  while (list.models.length < count && list.next) {
110
  const response = await fetchOk(list.next);
111
  list.models.push(...(await response.json())
112
+ // Sentence Transformers supports tagged models even when their primary
113
+ // library is transformers (for example, EmbeddingGemma 2). Match its Hub
114
+ // listing; retain the primary-library restriction for the other tabs.
115
+ .filter((model) => library === "sentence-transformers" || model.library_name === library)
116
  .map((model) => ({ id: model.id, score: model[sort] ?? 0, params: model.safetensors?.total })));
117
  list.next = response.headers.get("Link")?.match(/<([^>]+)>;\s*rel="next"/)?.[1];
118
  }
 
218
  select(active, "version", versionsOf(s.sdk)),
219
  nameField),
220
  ...(selected ? [h("p", { class: "pair" }, `neuronx-cc ${latest.sdk} · ${active} ${latest.version}`)] : [tasks]),
221
+ ...(active === "sentence-transformers" ? [h("p", { class: "intro" },
222
+ "Text retrieval with SentenceTransformer, CrossEncoder, and MultiVectorEncoder. "
223
+ + "The query asks which planet is the Red Planet; documents are Venus, Mars, Jupiter, and Saturn. "
224
+ + "PASS requires finite scores, Mars ranked first, and CPU score agreement (atol=rtol=0.001). "
225
+ + "Open a run for scores, precision, and configuration details. SparseEncoder is not covered.")] : []),
226
  results);
227
 
228
  let runs, rank, exclusions, taskList;
 
351
  h("p", {}, `${badge(run.result)} · ${run.neuron_cores} NeuronCore${run.neuron_cores > 1 ? "s" : ""}`
352
  + ` · ${run.runner} · ${run.library} ${run.library_version}`
353
  + ` · tested ${day(run.tested_at)}`),
354
+ ...(run.library === "sentence-transformers" ? [
355
+ h("h3", {}, "Retrieval validation"),
356
+ h("p", {}, run.notes ?? ""),
357
+ h("p", {}, `CPU parity: ${run.cpu_match ?? "not recorded"}`),
358
+ h("p", {}, `Transformers ${run.transformers}; text-only, one logical Neuron device. `
359
+ + "This checks one retrieval example, not general model quality or throughput."),
360
+ ] : []),
361
  h("h3", {}, "Run it"),
362
  h("p", {}, `On a ${TARGETS[target]?.name ?? target} (${target}) instance with this Neuron stack,`
363
  + " for example in the AWS Neuron Deep Learning Container:"),
364
  h("dl", {}, stack.map(([name, version]) => [h("dt", {}, name), h("dd", {}, h("code", {}, version))])),
365
  h("ol", {},
366
  pip && h("li", {}, "Install the packages the script adds:", h("pre", {}, pip)),
367
+ run.library !== "sentence-transformers" && h("li", {}, "Optionally, skip compilation with the graphs this compiler already built:",
368
  h("pre", {}, `hf buckets sync ${NEFF_CACHE}/${target}/neuronxcc-${run.neuronx_cc} /tmp/neff_cache`)),
369
  h("li", {}, "Download ", h("a", { href: scriptUrl, download: "run.py" }, "run.py"), " and run it",
370
  run.neuron_cores > 1 ? ". It launches its own torch.distributed ranks:" : ":",