microsoft / onnxruntime

ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
https://onnxruntime.ai
MIT License
14.49k stars 2.9k forks source link

[Web] ReferenceError: 'self' is not defined #17421

Open hunnble opened 1 year ago

hunnble commented 1 year ago

Describe the issue

When use ort to use pretrained model in browser, throw ReferenceError: 'self' is not defined.

To reproduce

pnpm install onnxruntime-web@1.15.1

then call:

import * as ort from 'onnxruntime-web';
const session = await ort.InferenceSession.create('./best.onnx');

Urgency

is urgent.

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

onnxruntime-web@1.15.1

Execution Provider

'webgl' (WebGL), 'wasm'/'cpu' (WebAssembly CPU)

fs-eire commented 1 year ago

Usually this should not happen. Could you share more info about how did you run the code snippet? Is it running in Node.js/deno/browser?

hunnble commented 1 year ago

It's running in figma plugin, which is a special environment with the Realms sandbox.

guschmue commented 1 year ago

a stack trace or the full log message would help.