[Web] How should I get wasm file? #19829
Labels
platform:web
issues related to ONNX Runtime web; typically submitted using template
stale
issues that have not been addressed in a while; categorized by a bot
Describe the issue
I use vue3+vite and load onnxruntime-web plugin. I meet some error. I get wasm file failed.
I wondering to know how should i get wasm file?
@fs-eire
My Vue3+Vite Version:
vue:"^3.4.15",
vite: "~3.0.4",
onnxruntime-web: "^1.17.1",
vite-plugin-static-copy: "^1.0.1",
In my vite.config.ts
import { viteStaticCopy } from 'vite-plugin-static-copy'
export default ({ mode }) => {
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) }
return defineConfig({
base: process.env.VITE_APP_BASE_URL,
plugins: [
vue(),
viteStaticCopy({
targets: [
{
src: "./node_modules/onnxruntime-web/dist/*.wasm",
dest: "./",
},
],
}),
removeConsole(),
}),
],
css: {postcss},
resolve: {
alias: {
'@': path.resolve(__dirname, 'src')
}
},
}
To reproduce
In My Vue app
import * as ort from 'onnxruntime-web';
const modelDir = 'https://mode-marie-ai-2023.s3.ap-northeast-1.amazonaws.com/inspiration_generator/onnx/sam_onnx_quantized_vit_h.onnx'
onMounted(async () => {
console.log('onMounted')
try {
if (modelDir === undefined) return
const modelUrl:string = modelDir
const aaa = await ort.InferenceSession.create(modelUrl)
console.log('completed')
} catch (error) {
console.log(error)
}
})
Urgency
urgent!
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
1.17.1
Execution Provider
Other / Unknown
The text was updated successfully, but these errors were encountered: