Skip to content

[Web] wasmPaths type changed - no available backend found #23515

Closed
@romankoho

Description

@romankoho

Describe the issue

Until version "onnxruntime-web": "1.17.1" I have set the links to my wasm files like this:

ort.env.wasm.wasmPaths = {
  'ort-wasm.wasm': '/sam/ort-wasm.wasm',
  'ort-wasm-simd.wasm': '/sam/ort-wasm-simd.wasm',
  'ort-wasm-simd-threaded.wasm': '/sam/ort-wasm-simd-threaded.wasm',
  'ort-wasm-threaded.wasm': '/sam/ort-wasm-threaded.wasm'
}

// create inferenceSession and set model
  useEffect(() => {
    // Initialize the ONNX model
    const initModel = async () => {
      try {
        const URL: string = `${window.location.origin}${globalConfig.get().ONNX_MODEL_PATH}`
        const model = await InferenceSession.create(URL)
        setModel(model)
      } catch (e) {
        console.log(e)
      }
    }

    if (!model) {
      initModel()
    }
  }, [])

I have updated to version "onnxruntime-web 1.20.1 and apparently the type of wasmPaths changed.

Image

Also no backend is found anymore. This error is logged in the console when mounting the component where I have the above mentioned code.

Image

The wasm files are saved in public/sam

Image

I'd be happy for some hints on how to change the setup. Thanks!

To reproduce

Setup React project with vite

Setup:

  • React 18.2.0
  • Typescript: 4.9.5
  • Vite 4.5.5
  • "onnxruntime-web": "1.17.1",
  • copy wasm files to /public
  • set ort.env.wasm.wasmPaths
  • create model

Urgency

I can sty on 1.17.1 for now but would still like to know what I need to change

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

1.17.1

Execution Provider

'wasm'/'cpu' (WebAssembly CPU)

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform:webissues related to ONNX Runtime web; typically submitted using template

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions