Encountered a problem with running Transformers.js in a Joplin plugin, where they use webpack ( module: commonjs and target: es2015 in tsconfig.json)
-
The problem was first with webpack, solve it with this: [Bug] Problem working with Next.js · Issue #210 · xenova/transformers.js · GitHub
-
Another issue is that in runtime I go this error displayed below. The problem seems to be disabling onnxruntime-node which is necessary to solve the error in webpack. I managed to run Transformers.js in a project without webpack and during the model construction I saw the library uses onnx. This might be the issue: TypeError: Cannot read properties of undefined (reading ‘wasm’) · Issue #589 · xenova/transformers.js · GitHub
Something went wrong during model construction (most likely a missing operation). Using `wasm` as a fallback.
Kr @ plugin_com.example.JoplinSummarizeAILocal.js:2
2plugin_com.example.JoplinSummarizeAILocal.js:2 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'create')
at Kr (plugin_com.example.JoplinSummarizeAILocal.js:2:681968)
at async Promise.all (/Users/billtonhoang/Documents/GitHub/joplin-hahabill/joplin-hahabill-resolved/packages/app-desktop/services/plugins/index 1)
at async zo.from_pretrained (plugin_com.example.JoplinSummarizeAILocal.js:2:688061)
at async Mc.from_pretrained (plugin_com.example.JoplinSummarizeAILocal.js:2:721345)
at async Promise.all (/Users/billtonhoang/Documents/GitHub/joplin-hahabill/joplin-hahabill-resolved/packages/app-desktop/services/plugins/index 1)
at async plugin_com.example.JoplinSummarizeAILocal.js:2:788312
at async Zh (plugin_com.example.JoplinSummarizeAILocal.js:2:787993)
at async a.predict (plugin_com.example.JoplinSummarizeAILocal.js:2:561693)