dsh-livebench-panel 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.js +4 -1
- package/lib/index.js +37 -1
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -489,7 +489,10 @@ window.__ModuleLoader__.load({
|
|
|
489
489
|
disabled: busy || !config?.available || sel.models.length === 0,
|
|
490
490
|
}, `开始评测(${sel.models.length} 个模型并发)`),
|
|
491
491
|
running && h("button", { className: c("btn") + " " + c("btnDanger") + " " + c("btnBar"), onClick: onStop }, "停止全部"),
|
|
492
|
-
h("button", { className: c("btnGhost") + " " + c("btn") + " " + c("btnBar"), onClick: () => {
|
|
492
|
+
h("button", { className: c("btnGhost") + " " + c("btn") + " " + c("btnBar"), onClick: async () => {
|
|
493
|
+
try { await api("/clear", { method: "POST" }); } catch { /* ignore */ }
|
|
494
|
+
loadConfig(); loadResults(); refreshStatus();
|
|
495
|
+
} }, "刷新"),
|
|
493
496
|
),
|
|
494
497
|
startError !== null && h("p", { className: c("error") }, startError),
|
|
495
498
|
),
|
package/lib/index.js
CHANGED
|
@@ -103,7 +103,7 @@ const RELEASES = [
|
|
|
103
103
|
/** Sane cap so a runaway run cannot eat memory with its log. */
|
|
104
104
|
const LOG_MAX_LINES = 600;
|
|
105
105
|
/** One evaluation at a time per model, but several models may run concurrently. */
|
|
106
|
-
const MAX_CONCURRENT_RUNS =
|
|
106
|
+
const MAX_CONCURRENT_RUNS = 9;
|
|
107
107
|
|
|
108
108
|
/** Resolve the profile directory from the config-tree anchor (plugin-market pattern). */
|
|
109
109
|
function resolveProfileDir(ctx) {
|
|
@@ -657,6 +657,13 @@ function apply(ctx) {
|
|
|
657
657
|
...process.env,
|
|
658
658
|
HF_HOME: join(layout.root, ".hf_cache"),
|
|
659
659
|
HF_HUB_DISABLE_SYMLINKS_WARNING: "1",
|
|
660
|
+
// 限制评测进程的数值库线程(numpy/pyarrow/MKL 默认吃满全核,
|
|
661
|
+
// 多模型并发时会把 node 事件循环饿死 → websocket 断连)。
|
|
662
|
+
OMP_NUM_THREADS: "1",
|
|
663
|
+
MKL_NUM_THREADS: "1",
|
|
664
|
+
OPENBLAS_NUM_THREADS: "1",
|
|
665
|
+
NUMEXPR_NUM_THREADS: "1",
|
|
666
|
+
RAYON_NUM_THREADS: "1",
|
|
660
667
|
// run_livebench.py shells out to bare `python`; without the venv on
|
|
661
668
|
// PATH that resolves to the system interpreter and dies on the first
|
|
662
669
|
// livebench import (shortuuid etc.).
|
|
@@ -694,6 +701,15 @@ function apply(ctx) {
|
|
|
694
701
|
env,
|
|
695
702
|
windowsHide: true,
|
|
696
703
|
});
|
|
704
|
+
// 降低评测进程优先级:评测不应与 DSH/浏览器争抢 CPU
|
|
705
|
+
try {
|
|
706
|
+
if (child.pid) {
|
|
707
|
+
spawn("powershell", [
|
|
708
|
+
"-NoProfile", "-Command",
|
|
709
|
+
`(Get-Process -Id ${child.pid}).PriorityClass = 'BelowNormal'`,
|
|
710
|
+
], { windowsHide: true, stdio: "ignore" }).on("error", () => {});
|
|
711
|
+
}
|
|
712
|
+
} catch { /* 优先级设置失败不影响评测 */ }
|
|
697
713
|
|
|
698
714
|
const record = {
|
|
699
715
|
id: `${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
|
|
@@ -875,6 +891,26 @@ function apply(ctx) {
|
|
|
875
891
|
},
|
|
876
892
|
}), `${name}: stop route`);
|
|
877
893
|
|
|
894
|
+
ctx.effect(() => ctx.webServer.register({
|
|
895
|
+
kind: "exact",
|
|
896
|
+
path: `${API}/clear`,
|
|
897
|
+
handler: async (req, res) => {
|
|
898
|
+
if (req.method !== "POST") {
|
|
899
|
+
sendJson(res, 405, { ok: false, error: "method not allowed" });
|
|
900
|
+
return;
|
|
901
|
+
}
|
|
902
|
+
if (!originAllowed(req)) {
|
|
903
|
+
sendJson(res, 403, { ok: false, error: "forbidden origin" });
|
|
904
|
+
return;
|
|
905
|
+
}
|
|
906
|
+
let removed = 0;
|
|
907
|
+
for (const [id, r] of [...runs]) {
|
|
908
|
+
if (r.exitCode !== null) { runs.delete(id); removed += 1; }
|
|
909
|
+
}
|
|
910
|
+
sendJson(res, 200, { ok: true, removed });
|
|
911
|
+
},
|
|
912
|
+
}), `${name}: clear route`);
|
|
913
|
+
|
|
878
914
|
ctx.effect(() => ctx.webServer.register({
|
|
879
915
|
kind: "exact",
|
|
880
916
|
path: `${API}/results`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-livebench-panel",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "DSH web plugin: a LiveBench tab in the Trajectory view (right of 对话/轨迹). Run LiveBench evaluations against every model configured in the DeepSeek Harness — pick provider/model, category, task, release and question range from dropdowns, watch progress, and read scores in place.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|