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

onnxruntime-node doesn't work in 1.2.5 #18079

Open
ilyhalight opened this issue Mar 11, 2025 · 2 comments · May be fixed by #18107
Open

onnxruntime-node doesn't work in 1.2.5 #18079

ilyhalight opened this issue Mar 11, 2025 · 2 comments · May be fixed by #18107
Assignees
Labels
bug Something isn't working ecosystem Something that relates to package or framework compatibility node.js Compatibility with Node.js APIs

Comments

@ilyhalight
Copy link

What version of Bun is running?

1.2.5+013fdddc6

What platform is your computer?

Microsoft Windows NT 10.0.22631.0 x64

What steps can reproduce the bug?

  1. Clone https://github.com/microsoft/onnxruntime
  2. cd samples/nodejs/01_basic-usage
  3. bun install
  4. bun index.js
  5. Get error

What is the expected behavior?

data of result tensor 'c': 700,800,900,1580,1840,2100,2460,2880,3300

(returns with Bun 1.2.4 / Node)

What do you see instead?

failed to inference ONNX model: Error: Load model from ⼮潭敤⹬湯确 failed:Load model ⼮潭敤⹬湯确 failed. File doesn't exist.

or if remove try/catch block

20 |     constructor(pathOrBuffer, options) {
21 |         _OnnxruntimeSessionHandler_inferenceSession.set(this, void 0);
22 |         (0, binding_1.initOrt)();
23 |         __classPrivateFieldSet(this, _OnnxruntimeSessionHandler_inferenceSession, new binding_1.binding.InferenceSession(), "f");
24 |         if (typeof pathOrBuffer === 'string') {
25 |             __classPrivateFieldGet(this, _OnnxruntimeSessionHandler_inferenceSession, "f").loadModel(pathOrBuffer, options);
                                                                                                ^
error: Load model from ⼮潭敤⹬湯确 failed:Load model ⼮潭敤⹬湯确 failed. File doesn't exist
      at new OnnxruntimeSessionHandler (REPLACED\onnxruntime\samples\nodejs\01_basic-usage\node_modules\onnxruntime-node\dist\backend.js:25:92)
      at <anonymous> (REPLACED\onnxruntime\samples\nodejs\01_basic-usage\node_modules\onnxruntime-node\dist\backend.js:67:29)

Bun v1.2.5 (Windows x64)

Additional information

If I downgrade Bun to 1.2.4 or if i use WSL with Ubuntu, problem disappears

@ilyhalight ilyhalight added bug Something isn't working needs triage labels Mar 11, 2025
@heimskr
Copy link
Member

heimskr commented Mar 11, 2025

Appears to be a case of reinterpreting UTF-8/ASCII text as UTF-16. If you decode the UTF-16 and interpret the bytes as an ASCII string you get ./model.onnx.

@190n
Copy link
Contributor

190n commented Mar 11, 2025

Probably the same bug as #18069, which I should have fixed by the end of the day.

@190n 190n self-assigned this Mar 11, 2025
@RiskyMH RiskyMH added node.js Compatibility with Node.js APIs ecosystem Something that relates to package or framework compatibility and removed needs triage labels Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ecosystem Something that relates to package or framework compatibility node.js Compatibility with Node.js APIs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants