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] custom wasm model location path for inference #22504

Open
sca1235 opened this issue Oct 18, 2024 · 1 comment
Open

[Web] custom wasm model location path for inference #22504

sca1235 opened this issue Oct 18, 2024 · 1 comment
Labels
api:Javascript issues related to the Javascript API platform:web issues related to ONNX Runtime web; typically submitted using template

Comments

@sca1235
Copy link

sca1235 commented Oct 18, 2024

Describe the issue

we are using onnxruntime-web and want to know if there is a configuration to customize the nn inference location. the method now is getting from the root of the app build but we want to do a custom path.

anyone have idea on how to change so the wasm can be in own custom location?

Trying to find way to set custom wasm paths.

Unfortunately, direct configuration for custom WASM file paths via ONNX Runtime Web's API is not supported. Instead, the solution revolves around ensuring the files are served from the correct path that ONNX Runtime expects.

To reproduce

we are building the wasm but when we call the innference it only using the root location. we placed the wasm elsewhere.

import cv from "@techstark/opencv-js";
import { Tensor, InferenceSession } from "onnxruntime-web";
import CryptoJS from 'crypto-js';

window.liveIdLibraries = {
    Tensor: Tensor,
    InferenceSession: InferenceSession,
    CryptoJS: CryptoJS,
    cv: cv
};

And then our webpack, we do this:

new CopyPlugin({
    patterns: [
        {
            from: path.resolve(path.join(__dirname, 'node_modules', 'onnxruntime-web', 'dist', '*.wasm')),
            to: "../html/assets/js/id-models/[name][ext]"
        },
    ],
}),

Urgency

No response

Platform

Windows

OS Version

web

ONNX Runtime Installation

Built from Source

ONNX Runtime Version or Commit ID

1

ONNX Runtime API

JavaScript

Architecture

X64

Execution Provider

Default CPU

Execution Provider Library Version

No response

@github-actions github-actions bot added api:Javascript issues related to the Javascript API platform:web issues related to ONNX Runtime web; typically submitted using template labels Oct 18, 2024
@gyagp
Copy link
Contributor

gyagp commented Oct 19, 2024

Are you looking for ort.env.wasm.wasmPaths?

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

No branches or pull requests

2 participants