Skip to content

transformersjs: update to transformers.js 4.3.2 - #332

Open
danleh wants to merge 1 commit into
WebKit:mainfrom
danleh:wasm-transformersjs-4
Open

danleh wants to merge 1 commit into
WebKit:mainfrom
danleh:wasm-transformersjs-4

Conversation

@danleh

@danleh danleh commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Part of #277.

Update @huggingface/transformers from 3.7.2 to 4.3.2. It pins onnxruntime-web 1.31.0-dev.20260914-8d85527a0 (was 1.21.0), whose Wasm build moves from Emscripten 4.0.3 to 4.0.23. Models and inputs are bit-identical.

To review (4 files, +38/−19; the other 4 files are build output):

  • transformers.js 4 is bundled with esbuild instead of Webpack, so transformers.js.patch (a fix for Webpack's publicPath detection in shells) is gone.
  • benchmark.js adds a Headers polyfill, since 4.x reads response headers, and routes env.fetch and a missing global fetch through the preload redirect.
  • benchmark.js deletes Atomics.waitAsync. ONNX Runtime runs single-threaded, but Emscripten's pthread setup registers an async waiter that never resolves and keeps the jsc shell alive.
  • build.sh logs the transformers.js and ORT versions, and util/package.json pins transformers.js to exactly 4.3.2.

Binaries: ort-wasm-simd-threaded.wasm grows from 11.1 MB to 14.3 MB, with 14% more SIMD instructions; the transformers.js bundle shrinks by 39%.

Scores (measured on a Linux x64 workstation with jsvu shells, each test alone in a fresh shell, 6 rounds; change of the mean score, bold = statistically significant at 95% confidence; @kmiller68 may want to check on macOS / arm64):

Test d8 (15.9.60) jsc (325217) SpiderMonkey (160.0b3)
transformersjs-bert-wasm +1.5% +7.4% +4.5%
transformersjs-whisper-wasm +1.7% +2.7% +2.0%
Geomean +1.6% +5.0% +3.2%
First and Average subscores
Test d8 First / Average jsc First / Average SpiderMonkey First / Average
transformersjs-bert-wasm −9.1% / +8.5% +0.7% / +10.5% −5.6% / +10.1%
transformersjs-whisper-wasm −0.4% / +2.4% +4.2% / +1.7% +2.6% / +2.6%

Update @huggingface/transformers from 3.7.2 to 4.3.2. It pins
onnxruntime-web 1.31.0-dev.20260914-8d85527a0 (was 1.21.0), whose Wasm
build moves from Emscripten 4.0.3 to 4.0.23. Models and inputs are
bit-identical.

- transformers.js 4.x is bundled with esbuild instead of Webpack, so
  transformers.js.patch (a fix for Webpack's publicPath detection in
  shells) is gone.
- benchmark.js adds a Headers polyfill, since 4.x reads response
  headers, and routes env.fetch and a missing global fetch through the
  preload redirect.
- benchmark.js deletes Atomics.waitAsync. ONNX Runtime runs
  single-threaded, but Emscripten's pthread setup registers an async
  waiter that never resolves and keeps the jsc shell alive.
- build.sh logs the transformers.js and ORT versions, and
  util/package.json pins transformers.js to exactly 4.3.2.

ort-wasm-simd-threaded.wasm grows from 11.1 MB to 14.3 MB, with 14% more
SIMD instructions. The transformers.js bundle shrinks by 39%.

Score change, d8 (15.9.60) / jsc (325217) / SpiderMonkey (160.0b3) (each
test alone in a fresh shell, 6 rounds):
  transformersjs-bert-wasm     +1.5% / +7.4% / +4.5%
  transformersjs-whisper-wasm  +1.7% / +2.7% / +2.0%

Part of WebKit#277.
@danleh
danleh requested review from eqrion and kmiller68 November 3, 2026 18:49
@netlify

netlify Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for webkit-jetstream-preview ready!

Name Link
🔨 Latest commit e5013ea
🔍 Latest deploy log https://app.netlify.com/projects/webkit-jetstream-preview/deploys/6aea2cb4d3e399e2cfd658b9
😎 Deploy Preview https://deploy-preview-332--webkit-jetstream-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@danleh danleh added the v3.1 label Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant