question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature: Support vscode-languagedetection on the wasm backend

See original GitHub issue

Please 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 of cpu
  • 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:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mattsoulanillecommented, Oct 4, 2021

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’s register_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.

0reactions
rthadurcommented, Sep 9, 2022

StringSplit has been added here https://github.com/tensorflow/tfjs/pull/5715 , please check the latest version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

WASM backend fails on recent versions of Edge/Chromimum
WASM backend fails on recent versions of Edge/Chromimum Tested with ... reports warning message Aborted(no native wasm support detected) and ...
Read more >
Introducing the WebAssembly backend for TensorFlow.js
We're happy to announce that TensorFlow.js now provides a WebAssembly (WASM) backend for both the browser and for Node.js!
Read more >
Tweag on Twitter: "Huge news for Haskell today: our WASM ...
Huge news for Haskell today: our WASM backend has been merged into GHC! Compared to our older "Asterius" work, the result is greater...
Read more >
FAQ - WebAssembly
WebAssembly initially focuses on C/C++, and a new, clean WebAssembly backend is being developed in upstream clang/LLVM, which can then be used by...
Read more >
Building to WebAssembly - Emscripten
The wasm backend is strict about linking files with different features sets - for example, if one file was built with atomics but...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found