Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add simple JS backend #2072

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

zamfofex
Copy link

@zamfofex zamfofex commented Oct 6, 2024

I was told this might be desirable. A couple things to note:

  • I wish to be able to publish this as a package to npm eventually. (I hope this can be allowed!)
  • I have only tried this with Emscripten v3.1.57, see: Compiled code using pthreads breaks Vite bundler emscripten-core/emscripten#22394
  • If there is anything I can improve, I’d love to try to!
  • I set this as a draft pull request because I think the documentation could be improved, and also because I have set up some ORT‐web compatibility changes very directly, whereas they should probably be conditional.
  • This only works well in browsers with WebGPU enabled (and in computers with a decent GPU), so this is currently fairly niche.

If anyone has any thoughts on whether this is warranted, I’d love to know! (Do let me know what you think!)

Some more technical details: This works by converting an Lc0 network to ONNX format and then using the ORT‐web APIs to allow Lc0 to interface with the network through JavaScript.

src/neural/onnx/converter.h Outdated Show resolved Hide resolved
src/neural/onnx/builder.cc Outdated Show resolved Hide resolved
src/chess/uciloop.cc Outdated Show resolved Hide resolved
@zamfofex zamfofex force-pushed the js-backend branch 2 times, most recently from fc53216 to 7be1ab0 Compare December 21, 2024 08:17
@zamfofex zamfofex marked this pull request as ready for review December 21, 2024 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants