fix: R4 探针页 tensor 复用(proxy 下 buffer 被 detach)+ pipeline.sh 7 处 GBK 读取 + r4 分支返回码;r4 端到端 rc=0
- webapp/r4_probe.html:feat 移进 run() 每次新建。proxy=1 时 ORT 把输入 transfer 给 Worker,旧写法第二次 run 报 Tensor size(83) vs data length(0),两种 proxy 配置全挂、r4.json pass=null。 - ml/pipeline.sh:7 处 json.load(open(...)) 补 encoding='utf-8'(:90 :110 :118 :127 :136 :138 :144)。r4.json 以 ensure_ascii=False 写出,Windows GBK 下 :110 实测 UnicodeDecodeError,命令替换为空会让上层分支走错。 - ml/pipeline.sh r4:末行 `[ "$r" = null ] && echo` 在 r=pass 时整体返回 1,set -e + EXIT trap 把通过的 r4 记成 rc=1(all 会因此停)→ 改 if/fi。 - 实测复跑两次:pass=true,部署口径(16 线程+proxy+enc_once)P99 10.22 / 11.25 ms,4 线程 13.58/13.64,无 proxy 9.28/10.92,webgpu 仍 backend not found。 - 文档同步:A 组两处标记已修,仅留 A-3(ortLocal+proxy 离线路径)交实现方。
This commit is contained in:
@@ -25,9 +25,10 @@
|
||||
if (res.proxy) { ort.env.wasm.proxy = true; try { sess = await ort.InferenceSession.create(MODEL, opts); } catch (e) { res.proxyError = String(e); res.proxy = false; ort.env.wasm.proxy = false; } }
|
||||
if (!sess) sess = await ort.InferenceSession.create(MODEL, opts);
|
||||
res.encOnce = !!meta.enc_once;
|
||||
const feat = new Float32Array((res.encOnce ? 1 : K) * F).map(() => Math.random() - 0.5);
|
||||
const z = () => new Float32Array(K * H * 6).map(() => Math.random() * 2 - 1);
|
||||
const run = () => sess.run({ feat: new ort.Tensor('float32', feat, [res.encOnce ? 1 : K, F]), z: new ort.Tensor('float32', z(), [K, H, 6]) });
|
||||
/* proxy 模式下 ORT 会把输入 buffer 转移给 Worker(detach),feat 必须每次新建 */
|
||||
const run = () => { const feat = new Float32Array((res.encOnce ? 1 : K) * F).map(() => Math.random() - 0.5);
|
||||
return sess.run({ feat: new ort.Tensor('float32', feat, [res.encOnce ? 1 : K, F]), z: new ort.Tensor('float32', z(), [K, H, 6]) }); };
|
||||
for (let i = 0; i < 10; i++) await run();
|
||||
let last = performance.now(); const gaps = [];
|
||||
const tk = setInterval(() => { const t = performance.now(); gaps.push(t - last); last = t; }, 20);
|
||||
|
||||
Reference in New Issue
Block a user