Closed wizardAEI closed 9 months ago
Additionally, I'm confused why the error is reported in the '/node_modules/onnxruntime-web' directory instead of onnxruntime-node.
Hi there 👋 Have you tried our example electron app template (link)? Also, can you confirm if the code is running in the main process, or the renderer process?
I just tried it on an Electron template and got the same error. Could it be that I made a mistake in my operation?
The onnxruntime backend (web or node) is selected using this line: https://github.com/xenova/transformers.js/blob/07df34ff3308cf3b1ab830a547bd9bcf22869783/src/backends/onnx.js#L32
Could you manually check the values of these?
i cant console there. but when I commented out part of the code but still got errors.
And I printed the value at the place of process?.release?.name
where the function is called, which is node.
and I log in the /node_modules/@xenova/transformers/src/utils/hub.js :
print the node in the terminal
I just tried it on an Electron template and got the same error. Could it be that I made a mistake in my operation?
Are you saying that without any modifications to the example template, you are experiencing these issues?
I just tried it on an Electron template and got the same error. Could it be that I made a mistake in my operation?
Are you saying that without any modifications to the example template, you are experiencing these issues?
No, I made some changes, mainly to introduce local model. All the modifications are annotated in the above picture. (I added two lines of code and several files, all highlighted in red boxes.)
And the error won't occur unless I try to introduce an ONNX file.
Can you confirm that the path does indeed map to the correct location? The default local path is /models/
, so perhaps you are missing the trailing slash? Also, if you are able to add debug statements, could you try see what paths are used here:
its right path
I'm really sorry, I just noticed that my onnx file somehow became an empty file at some point.
I'll try again after re-downloading the onnx file.
No worries! 😇 Let's hope that's the fix! 🤞
I succeeded in running!
Really sorry, my negligence has caused you such a long delay!
Thank you very much.
Great! 🥳 Absolutely no worries :) Glad it's sorted 🚀
System Info
os: mac-arm node: v18.18.2 electron: "28.0.0", electron-vite: "^1.0.27",
Environment/Platform
Description
Hello! I want to use transformers.js in an Electron application, but I've encountered some issues. Can you please take a look?
An error occurred when importing ONNX file in the main process of Electron.
Reproduction
when i want to load the model:
there is the error: