[PR #2] [MERGED] Remove onnxruntime-node dependency, always use onnxruntime-web WASM runtime #4

Closed
opened 2026-10-15 18:08:52 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/SillyTavern/transformers.js/pull/2
Author: @Copilot
Created: 3/13/2026
Status: ✅ Merged
Merged: 3/15/2026
Merged by: @Cohee1207

Base: main ← Head: copilot/remove-onnxruntime-node-dependency


📝 Commits (4)

📊 Changes

12 files changed (+36 additions, -270 deletions)

View changed files

📝 packages/transformers/docs/source/tutorials/next-ai-sdk.md (+0 -1)
📝 packages/transformers/docs/source/tutorials/next.md (+1 -2)
📝 packages/transformers/package.json (+0 -1)
📝 packages/transformers/scripts/build/constants.mjs (+3 -3)
📝 packages/transformers/scripts/build/plugins/ignoreModulesPlugin.mjs (+0 -1)
📝 packages/transformers/src/backends/onnx.js (+7 -46)
📝 packages/transformers/src/backends/utils/cacheWasm.js (+0 -2)
📝 packages/transformers/src/env.js (+1 -1)
📝 packages/transformers/src/utils/devices.js (+2 -7)
📝 packages/transformers/tests/init.js (+22 -36)
📝 pnpm-lock.yaml (+0 -169)
📝 pnpm-workspace.yaml (+0 -1)

📄 Description

Drops onnxruntime-node entirely. All environments (browser, Node.js, Deno) now use onnxruntime-web WASM backend.

Backend (src/backends/onnx.js)

  • Removed onnxruntime-node import and the IS_NODE_ENV branch that selected the native backend
  • Always uses ONNX_WEB from onnxruntime-web/webgpu
  • Removed native-only execution providers (cuda, dml, coreml) from device mapping
  • cpu device now maps to wasm EP for backward compatibility
  • Session creation and inference always chain (consistent WASM behavior)

Device types (src/utils/devices.js)

  • Removed cuda, dml, coreml from DEVICE_TYPES
  • Default device is wasm for all environments (was cpu for Node.js)

Build config

  • NODE_EXTERNAL_MODULES: replaced onnxruntime-node with onnxruntime-web
  • NODE_IGNORE_MODULES: no longer ignores onnxruntime-web
  • WEB_IGNORE_MODULES: no longer needs to ignore onnxruntime-node
  • Removed onnxruntime-node case from ignoreModulesPlugin

Tests (tests/init.js)

  • Replaced onnxruntime-node/dist/backend import with onnxruntime-web
  • Monkey-patching for Jest VM context issues applied directly at init time instead of wrapping the native backend's init()

Housekeeping

  • Removed onnxruntime-node from pnpm-workspace.yaml onlyBuiltDependencies
  • Updated Next.js tutorial docs (removed webpack alias for onnxruntime-node$, updated serverComponentsExternalPackages)
  • Removed stale comments referencing onnxruntime-node

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cdn.jsdelivr.net
    • Triggering command: /opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/bin/node --experimental-vm-modules --expose-gc /home/REDACTED/work/transformers.js/transformers.js/node_modules/.pnpm/jest-worker@30.2.0/node_modules/jest-worker/build/processChild.js (dns block)
  • huggingface.co
    • Triggering command: /opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/bin/node --experimental-vm-modules --expose-gc /home/REDACTED/work/transformers.js/transformers.js/node_modules/.pnpm/jest-worker@30.2.0/node_modules/jest-worker/build/processChild.js (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node --experimental-vm-modules --expose-gc node_modules/jest/bin/jest.js --verbose --logHeapUsage tests/configs.test.js (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node --experimental-vm-modules --expose-gc node_modules/jest/bin/jest.js --verbose --logHeapUsage tests/configs.test.js ndor/bin/git (dns block)
  • picsum.photos
    • Triggering command: /opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/bin/node --experimental-vm-modules --expose-gc /home/REDACTED/work/transformers.js/transformers.js/node_modules/.pnpm/jest-worker@30.2.0/node_modules/jest-worker/build/processChild.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/SillyTavern/transformers.js/pull/2 **Author:** [@Copilot](https://github.com/apps/copilot-swe-agent) **Created:** 3/13/2026 **Status:** ✅ Merged **Merged:** 3/15/2026 **Merged by:** [@Cohee1207](https://github.com/Cohee1207) **Base:** `main` ← **Head:** `copilot/remove-onnxruntime-node-dependency` --- ### 📝 Commits (4) - [`9dd1b0c`](https://github.com/SillyTavern/transformers.js/commit/9dd1b0c357c1cad86c10f2bd0687024c95268209) Initial plan - [`9010c19`](https://github.com/SillyTavern/transformers.js/commit/9010c19665d9724872db880d0c02b27a4ee73025) Remove onnxruntime-node dependency and always use onnxruntime-web WASM runtime - [`8ee92f6`](https://github.com/SillyTavern/transformers.js/commit/8ee92f639348ea16484715fc4c739b4379712710) Resolve merge conflicts: incorporate jimp replacement from main - [`5c0a843`](https://github.com/SillyTavern/transformers.js/commit/5c0a8439b08add220f711e3b7ffad6ed86ba7609) Merge branch 'main' of https://github.com/SillyTavern/transformers.js into copilot/remove-onnxruntime-node-dependency ### 📊 Changes **12 files changed** (+36 additions, -270 deletions) <details> <summary>View changed files</summary> 📝 `packages/transformers/docs/source/tutorials/next-ai-sdk.md` (+0 -1) 📝 `packages/transformers/docs/source/tutorials/next.md` (+1 -2) 📝 `packages/transformers/package.json` (+0 -1) 📝 `packages/transformers/scripts/build/constants.mjs` (+3 -3) 📝 `packages/transformers/scripts/build/plugins/ignoreModulesPlugin.mjs` (+0 -1) 📝 `packages/transformers/src/backends/onnx.js` (+7 -46) 📝 `packages/transformers/src/backends/utils/cacheWasm.js` (+0 -2) 📝 `packages/transformers/src/env.js` (+1 -1) 📝 `packages/transformers/src/utils/devices.js` (+2 -7) 📝 `packages/transformers/tests/init.js` (+22 -36) 📝 `pnpm-lock.yaml` (+0 -169) 📝 `pnpm-workspace.yaml` (+0 -1) </details> ### 📄 Description Drops `onnxruntime-node` entirely. All environments (browser, Node.js, Deno) now use `onnxruntime-web` WASM backend. ### Backend (`src/backends/onnx.js`) - Removed `onnxruntime-node` import and the `IS_NODE_ENV` branch that selected the native backend - Always uses `ONNX_WEB` from `onnxruntime-web/webgpu` - Removed native-only execution providers (`cuda`, `dml`, `coreml`) from device mapping - `cpu` device now maps to `wasm` EP for backward compatibility - Session creation and inference always chain (consistent WASM behavior) ### Device types (`src/utils/devices.js`) - Removed `cuda`, `dml`, `coreml` from `DEVICE_TYPES` - Default device is `wasm` for all environments (was `cpu` for Node.js) ### Build config - `NODE_EXTERNAL_MODULES`: replaced `onnxruntime-node` with `onnxruntime-web` - `NODE_IGNORE_MODULES`: no longer ignores `onnxruntime-web` - `WEB_IGNORE_MODULES`: no longer needs to ignore `onnxruntime-node` - Removed `onnxruntime-node` case from `ignoreModulesPlugin` ### Tests (`tests/init.js`) - Replaced `onnxruntime-node/dist/backend` import with `onnxruntime-web` - Monkey-patching for Jest VM context issues applied directly at init time instead of wrapping the native backend's `init()` ### Housekeeping - Removed `onnxruntime-node` from `pnpm-workspace.yaml` `onlyBuiltDependencies` - Updated Next.js tutorial docs (removed webpack alias for `onnxruntime-node$`, updated `serverComponentsExternalPackages`) - Removed stale comments referencing onnxruntime-node > [!WARNING] > > <details> > <summary>Firewall rules blocked me from connecting to one or more addresses (expand for details)</summary> > > #### I tried to connect to the following addresses, but was blocked by firewall rules: > > - `cdn.jsdelivr.net` > - Triggering command: `/opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/bin/node --experimental-vm-modules --expose-gc /home/REDACTED/work/transformers.js/transformers.js/node_modules/.pnpm/jest-worker@30.2.0/node_modules/jest-worker/build/processChild.js` (dns block) > - `huggingface.co` > - Triggering command: `/opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/bin/node --experimental-vm-modules --expose-gc /home/REDACTED/work/transformers.js/transformers.js/node_modules/.pnpm/jest-worker@30.2.0/node_modules/jest-worker/build/processChild.js` (dns block) > - Triggering command: `/home/REDACTED/work/_temp/ghcca-node/node/bin/node node --experimental-vm-modules --expose-gc node_modules/jest/bin/jest.js --verbose --logHeapUsage tests/configs.test.js` (dns block) > - Triggering command: `/home/REDACTED/work/_temp/ghcca-node/node/bin/node node --experimental-vm-modules --expose-gc node_modules/jest/bin/jest.js --verbose --logHeapUsage tests/configs.test.js ndor/bin/git` (dns block) > - `picsum.photos` > - Triggering command: `/opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/bin/node --experimental-vm-modules --expose-gc /home/REDACTED/work/transformers.js/transformers.js/node_modules/.pnpm/jest-worker@30.2.0/node_modules/jest-worker/build/processChild.js` (dns block) > > If you need me to access, download, or install something from one of these locations, you can either: > > - Configure [Actions setup steps](https://gh.io/copilot/actions-setup-steps) to set up my environment, which run before the firewall is enabled > - Add the appropriate URLs or hosts to the custom allowlist in this repository's [Copilot coding agent settings](https://github.com/SillyTavern/transformers.js/settings/copilot/coding_agent) (admins only) > > </details> <!-- START COPILOT CODING AGENT TIPS --> --- 📍 Connect Copilot coding agent with [Jira](https://gh.io/cca-jira-docs), [Azure Boards](https://gh.io/cca-azure-boards-docs) or [Linear](https://gh.io/cca-linear-docs) to delegate work to Copilot in one click without leaving your project management tool. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-15 18:08:52 +00:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
SillyTavern/transformers.js#4
No description provided.