diff --git a/e2e/e3-bench.mjs b/e2e/e3-bench.mjs new file mode 100644 index 0000000..2d13a64 --- /dev/null +++ b/e2e/e3-bench.mjs @@ -0,0 +1,23 @@ +// E3: browser-tier benchmark through the LIVE /neural page (paper C). +import { chromium } from "@playwright/test" + +const URL = "https://interscript.org/neural" +const MODEL = "tha-g2p-small-1.0" // smallest tier for a headless-runnable pass +const browser = await chromium.launch() +const page = await browser.newPage() + +const t0 = Date.now() +await page.goto(URL, { waitUntil: "networkidle" }) +console.log(`page load: ${Date.now() - t0} ms`) + +await page.selectOption("#model", MODEL) +await page.evaluate(() => caches.keys().then((k) => Promise.all(k.map((n) => caches.delete(n))))) +for (const pass of ["cold", "warm"]) { + const t1 = Date.now() + await page.click("#run") + await page.waitForFunction(() => document.getElementById("output").textContent.length > 0, null, { timeout: 600000 }) + const out = await page.textContent("#output") + console.log(`${pass} resolve+session+decode: ${Date.now() - t1} ms (out ${out.length}B)`) + if (pass === "cold") await page.click("#clear-cache") +} +await browser.close() diff --git a/e2e/e3-debug.mjs b/e2e/e3-debug.mjs new file mode 100644 index 0000000..dd46660 --- /dev/null +++ b/e2e/e3-debug.mjs @@ -0,0 +1,16 @@ +import { chromium } from "@playwright/test" +const b = await chromium.launch() +const p = await b.newPage() +await p.goto("https://interscript.org/neural", { waitUntil: "networkidle" }) +const res = await p.evaluate(async () => { + try { + const r = await fetch("https://github.com/interscript/interscript-ml/releases/download/index-v2/models-index.yaml.sha256") + return `ok ${r.status}` + } catch (e) { return `FAIL ${e.message} | ${e.cause?.message ?? ""}` } +}) +console.log("index fetch:", res) +const same = await p.evaluate(async () => { + try { const r = await fetch("/v1/info"); return `ok ${r.status}` } catch (e) { return `FAIL ${e.message}` } +}) +console.log("same-origin:", same) +await b.close() diff --git a/package-lock.json b/package-lock.json index 8c838cb..c3685bc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,7 @@ "@iso24229/iso639-data": "^0.2.0", "@tailwindcss/vite": "^4.0.0", "astro": "^7.0.0", - "interscript": "^5.2.0", + "interscript": "^5.2.1", "onnxruntime-web": "^1.29.0", "tailwindcss": "^4.0.0", "vue": "^3.5.0" @@ -6427,9 +6427,9 @@ "license": "ISC" }, "node_modules/interscript": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/interscript/-/interscript-5.2.0.tgz", - "integrity": "sha512-PFbDiYX/rMareAjKluBqv3vRBOBTC37Enc9hLAyb/pfrWSatHGQeFizj1wv0KoDocW8vRFLpSxY3PKi86Io77g==", + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/interscript/-/interscript-5.2.1.tgz", + "integrity": "sha512-iZJa5ErX4gMpFB1j4MLyrWccLJa6MTLAosXW3Pi2t1BcMGrl8Q+E8dV3I+R6NNoGgFsc2B0GK4BEuKP3ARZvoA==", "license": "BSD-2-Clause", "dependencies": { "fflate": "^0.8.3", diff --git a/package.json b/package.json index 2c68853..1ee7185 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "@iso24229/iso639-data": "^0.2.0", "@tailwindcss/vite": "^4.0.0", "astro": "^7.0.0", - "interscript": "^5.2.0", + "interscript": "^5.2.1", "onnxruntime-web": "^1.29.0", "tailwindcss": "^4.0.0", "vue": "^3.5.0" diff --git a/src/pages/neural.astro b/src/pages/neural.astro index 9a6c84c..376ad55 100644 --- a/src/pages/neural.astro +++ b/src/pages/neural.astro @@ -137,7 +137,8 @@ import Base from "../layouts/Base.astro" conf.textContent = `Decode confidence: min top-2 gap ${min.toFixed(2)} across ${gaps.length} steps (lower = less certain)` } } catch (e) { - out.textContent = `Error: ${(e as Error).message}` + const cause = (e as Error).cause as Error | undefined + out.textContent = `Error: ${(e as Error).message}${cause ? " | cause: " + cause.message : ""}` } })