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

Not able to use "wasm" in OnnxRuntime-Web. #18316

Closed
Tonystarq opened this issue Nov 7, 2023 · 1 comment
Closed

Not able to use "wasm" in OnnxRuntime-Web. #18316

Tonystarq opened this issue Nov 7, 2023 · 1 comment
Labels
platform:web issues related to ONNX Runtime web; typically submitted using template

Comments

@Tonystarq
Copy link

Describe the issue

Error: Error: no available backend found. ERR: [wasm] RuntimeError: Aborted(both async and sync fetching of the wasm failed). Build with -sASSERTIONS for more info.
I already confirmed and checked that my path is correctly loading for "ort-wasm.wasm" file but still not able to encounter why this error is coming. Although when i am trying to load and run model in "https://github.com/microsoft/onnxruntime-nextjs-template", then it is correctly working with "wasm" as backend. I changed all dependencies and next.config in my project as of onnxruntime template but it makes no difference.

To reproduce

Loading model in modelHelper.ts as:
Method1:
import * as ort from "onnxruntime-web"; const session = await ort.InferenceSession.create("./_next/static/chunks/pages/modelname.onnx",executionProviders:["wasm"], graphOptimizationLevel: "all" });
Method 2:
import { InferenceSession } from 'onnxruntime-web' const modelUrl = './modelname.onnx' const session= await InferenceSession.create(modelUrl, { executionProviders: ['wasm'], })
Next Config file:
`/** @type {import('next').NextConfig} */
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");

module.exports = {
reactStrictMode: true,
//distDir: 'build',
webpack: (config, { }) => {

config.resolve.extensions.push(".ts", ".tsx");
config.resolve.fallback = { fs: false };

config.plugins.push(
new NodePolyfillPlugin(), 
new CopyPlugin({
  patterns: [
    {
      from: './node_modules/onnxruntime-web/dist/ort-wasm.wasm',
      to: 'static/chunks/pages',
    },             {
      from: './node_modules/onnxruntime-web/dist/ort-wasm-simd.wasm',
      to: 'static/chunks/pages',
    },          
      {
        from: './model',
        to: 'static/chunks/pages',
      },
    ],
  }),
);

return config;

}
}`

Urgency

This project is for a client and need to submit before 10/11/2013

ONNX Runtime Installation

Built from Source

ONNX Runtime Version or Commit ID

^1.16.1

Execution Provider

'wasm'/'cpu' (WebAssembly CPU)

@Tonystarq Tonystarq added the platform:web issues related to ONNX Runtime web; typically submitted using template label Nov 7, 2023
@Tonystarq Tonystarq reopened this Nov 7, 2023
@nilamadhab47
Copy link

make sure to check the .wasm file path in the network tab of the console.log and copy plugin is the same

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