Feature: Support vscode-languagedetection on the wasm backend
See original GitHub issuePlease make sure that this is a bug. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:bug_template
System information
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow.js): yes
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): macOS Big Sur
- Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: n/a
- TensorFlow.js installed from (npm or script link): npm
- TensorFlow.js version (use command below): 3.9.0
- Browser version: node 14.17.5
- Tensorflow.js Converter Version: 3.9.0
Describe the current behavior
Error: Kernel 'StringSplit' not registered for backend 'wasm'
at Engine.runKernel (node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:4466:19)
at stringSplit_ (node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:24073:25)
at Object.stringSplit__op [as stringSplit] (node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:5406:29)
at executeOp$h (node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:6506:35)
at /Users/tyleonha/Code/Microsoft/vscode-languagedetection/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:6642:56
at /Users/tyleonha/Code/Microsoft/vscode-languagedetection/node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:4394:22
at Engine.scopedRun (node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:4404:23)
at Engine.tidy (node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:4393:21)
at Object.tidy (node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:10072:19)
at /Users/tyleonha/Code/Microsoft/vscode-languagedetection/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:6642:30
at executeOp$j (node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:6660:7)
at _loop_1 (node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:7418:31)
at GraphExecutor.processStack (node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:7444:13)
at GraphExecutor.<anonymous> (node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:7370:41)
at step (node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:81:23)
at Object.next (node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:62:53)
at fulfilled (node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:52:58)
Describe the expected behavior
Not throw error.
Standalone code to reproduce the issue
So I tried switching my library to using the wasm backend by changing this line: https://github.com/microsoft/vscode-languagedetection/blob/main/lib/index.ts#L163 (and importing the right package of course)
but it doesn’t seem like my model is playing nice with the wasm backend.
Steps are pretty simple:
- clone vscode-languagedetection
yarn add -D @tensorflow/tfjs-backend-wasm
- change the line above and also the import to use
wasm
instead ofcpu
- run
npm test
in the repo
Provide a reproducible test case that is the bare minimum necessary to generate the problem. If possible, please share a link to Colab/CodePen/any notebook.
Other info / logs Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (5 by maintainers)
Top GitHub Comments
Hi @TylerLeonhardt. You’re seeing this error because the
StringSplit
kernel is not implemented in the wasm backend yet. You can see a list of what ops each backend supports in the TFJS Ops Matrix or each backend’sregister_all_kernels.ts
file (here’s the one for wasm).I’ll change this issue to a feature request. It’s possible there are other ops in your model that are also not yet supported by wasm. If you add them here, we can better track and implement them.
StringSplit
has been added here https://github.com/tensorflow/tfjs/pull/5715 , please check the latest version.