Run Parakeet TDT in the inference worker via parakeet.js on the shared onnxruntime-web
Adds parakeet.js 1.4.4 (MIT) as a devDependency bundled into the worker only; a build plugin keeps its own onnxruntime-web copy out of the bundle. Includes an opt-in real-model test (PARAKEET_REAL=1). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c5a57cd33a
commit
708fae5778
10 files changed
+485
-7
No files matched your search
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Bun build plugin: parakeet.js's bare `onnxruntime-web` import resolves to
|
||||
* `src/worker/ortShim.ts` (= Transformers.js's `onnxruntime-web/webgpu`), so
|
||||
* the inference worker bundles exactly one onnxruntime (D-WS7a). Used by the
|
||||
* production build (scripts/build.ts) and the dev server's worker bundle
|
||||
* (src/index.ts). Without it the bundle carries parakeet.js's own 1.24.1
|
||||
* copy as well — never executed, but ~0.5 MB of dead weight and a CDN
|
||||
* wasmPaths default.
|
||||
*/
|
||||
|
||||
import type { BunPlugin } from "bun";
|
||||
import { join } from "node:path";
|
||||
|
||||
const SHIM = join(import.meta.dir, "../src/worker/ortShim.ts");
|
||||
|
||||
export const ortAliasPlugin: BunPlugin = {
|
||||
name: "parakeet-ort-alias",
|
||||
setup(build) {
|
||||
build.onResolve({ filter: /^onnxruntime-web$/ }, (args) =>
|
||||
/[\\/]parakeet\.js[\\/]/.test(args.importer) ? { path: SHIM } : undefined,
|
||||
);
|
||||
},
|
||||
};
|
||||
Reference in new issue
Block a user