Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Web] no training with wasm on node #22799

Closed
tharvik opened this issue Nov 11, 2024 · 1 comment
Closed

[Web] no training with wasm on node #22799

tharvik opened this issue Nov 11, 2024 · 1 comment
Labels
platform:web issues related to ONNX Runtime web; typically submitted using template

Comments

@tharvik
Copy link

tharvik commented Nov 11, 2024

Describe the issue

I'm trying to train using onnxruntime-web on NodeJS but no wasm backend seems to work.
note: why not onnxruntime-node you ask? I want to run on both web and node, which based on the readme, should be supported; it's also why I'm using ESM instead of CommonJS.

sadly, I wasn't able to find a single version that works. and it isn't really clear which path should be imported. here goes a table of the error when trying to create a TrainingSession.

onnxruntime-web version import path error
1.17, 1.18 failed to asynchronously prepare wasm: LinkError: WebAssembly.instantiate(): Import #46 module="a" function="a": memory import must be a WebAssembly.Memory object
1.17, 1.18 /training Error: no available backend found. ERR: [wasm] ReferenceError: __dirname is not defined, [cpu] Error: previous call to 'initWasm()' failed. (loaded via ESM where __dirname doesn't exists)
1.19, 1.20, dev Error: Training backend could not be resolved. Make sure you're using the correct configuration & WebAssembly files.
1.19, 1.20, dev /training Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './training' is not defined by "exports" in [...]/node_modules/onnxruntime-web/package.json imported from [...]/[eval1]

also, 1.20 doesn't ship ort-training-wasm-simd-threaded.{wasm,mjs} anymore, which seems to be intended as per the release ("All ONNX Runtime Training packages have been deprecated"). but I don't see a web package with training in the new pkgs.

To reproduce

#!/bin/sh -eu

readonly VERSION=dev
readonly IMPORT=onnxruntime-web

npm init --yes
npm pkg set type=module
npm install "onnxruntime-web@${VERSION}"

node --experimental-default-type=module <<-EOF
import * as ort from "${IMPORT}";
await ort.TrainingSession.create({});
EOF

Urgency

that does block the ONNX support I wanted to provide in addition to TFJS. so bothering but not vital.

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

1.20, dev

Execution Provider

'wasm'/'cpu' (WebAssembly CPU)

@tharvik tharvik added the platform:web issues related to ONNX Runtime web; typically submitted using template label Nov 11, 2024
@guschmue
Copy link
Contributor

Sorry, we have stopped supporting training for ort-web since there wasn't much users for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:web issues related to ONNX Runtime web; typically submitted using template
Projects
None yet
Development

No branches or pull requests

2 participants