Open e-simpson opened 3 weeks ago
The solution to fix this, can be npm install onnxruntime-web@1.14.0, all fix the package.json, lock the onnxruntime-web to 1.14.0 version.
@gotomypc I use 1.18.0
currently which works great. I was just looking to use some new features from 1.19.0
😊
There are multiple changes for onnxruntime-web exports.
a TL;DR version:
import * as ort from 'onnxruntime-web/webgpu';
import * as ort from 'onnxruntime-web';
Just 2 .wasm files. copy the one you uses. See this link to check out options for importing.
Let me know if you have further questions
work item: examples should be updated.
@fs-eire thanks for the reply!
I copied the ort-wasm-simd-threaded.jsep.wasm into my static files, made sure I'm using 1.19.0
and importing with import * as ort from 'onnxruntime-web/webgpu';
I get the error:
Module not found: Package path ./webgpu is not exported from package
.../node_modules/onnxruntime-web (see exports field in .../node_modules/onnxruntime-web/package.json)
> 1 | import * as ort from 'onnxruntime-web/webgpu';
| ^
2 |
Strange. I tried to copy the ort-wasm-simd-threaded.wasm and use the base non-gpu version and nothing seems to be working. If I revert back to 1.18.0 everything seems to work.
@fs-eire thanks for the reply!
I copied the ort-wasm-simd-threaded.jsep.wasm into my static files, made sure I'm using
1.19.0
and importing withimport * as ort from 'onnxruntime-web/webgpu';
I get the error:Module not found: Package path ./webgpu is not exported from package .../node_modules/onnxruntime-web (see exports field in .../node_modules/onnxruntime-web/package.json) > 1 | import * as ort from 'onnxruntime-web/webgpu'; | ^ 2 |
Strange. I tried to copy the ort-wasm-simd-threaded.wasm and use the base non-gpu version and nothing seems to be working. If I revert back to 1.18.0 everything seems to work.
What bundler (and version) do you use? It looks like that your bundler is not reading from the "export" field of onnxruntime-web's package.json
@fs-eire Bundling with webpack 5.93.0 (what the latest Next.js comes with)
Yeah, and I see the 1.19.0
package exports for web-gpu
"./webgpu": {
"node": null,
"import": "./dist/ort.webgpu.bundle.min.mjs",
"require": "./dist/ort.webgpu.min.js",
"types": "./types.d.ts"
},
For reference the web-gpu exports for 1.18.0
"./webgpu": {
"import": "./dist/esm/ort.webgpu.min.js",
"require": "./dist/cjs/ort.webgpu.min.js",
"types": "./types.d.ts",
"default": "./dist/ort.webgpu.min.js"
},
Let me give turbopack a try
Since it's Next.js, make sure not using SSR (because importing 'onnxruntime-web/webgpu' from Node.js is explicitly disabled)
Describe the issue
Using a onnxruntime-web with a web bundler like CopyPlugin I am now getting
Package path ./webgpu is not exported from package
. When I manually try to bundle the .wasm's I getUnable to locate '..node_modules/onnxruntime-web/dist/ort-wasm.wasm' glob
.I assume the names changed with this update as I see the web bundling changed. I see now bundling was introduced with https://github.com/microsoft/onnxruntime/commit/dd805ff77d896e9ff5457818c49d2103d6ba6248. I looked for some migration docs but couldn't find any.
To reproduce
Can follow the current quick-start https://github.com/microsoft/onnxruntime-inference-examples/tree/main/js/quick-start_onnxruntime-web-bundler
or
const nextConfig = { webpack: (config) => { config.resolve.extensions.push(".ts", ".tsx"); config.resolve.fallback = { fs: false };
} }
export default nextConfig;
Module not found: Package path ./webgpu is not exported from package .../node_modules/onnxruntime-web