Leela Chess Zero ported to javascript and tensorflowjs.

520 views
Skip to first unread message

François Pays

unread,
Dec 27, 2018, 7:52:19 AM12/27/18
to TensorFlow.js Discussion
Hello,

I am glad to report that Leela Chess Zero has been ported to javascript and runs inside the browser thanks to tensorflowjs.

Leela Chess Zero is a free and open-source chess engine adapted from the Leela Zero Go engine and based on Google's AlphaGo Zero project.


And here is a working online example where you can play and analyse games inside Leela inside your browser:  https://frpays.github.io/lc0-js/

Leela Neural network are usually 6b to 20b residual networks with 64 to 128 filters.
Depending on the browser abilities (OffscreenCanvas), the engine works inside a worker or not.

More information about the Leela Zero Chess project here: http://lczero.org/

Best regards,

François

Shanqing Cai

unread,
Dec 27, 2018, 11:13:38 AM12/27/18
to TensorFlow.js Discussion
This is awesome. Thanks for sharing.

Nikhil Thorat

unread,
Dec 27, 2018, 12:00:56 PM12/27/18
to Shanqing Cai, TensorFlow.js Discussion
Wow this is very cool, thanks a lot for sharing!

--
You received this message because you are subscribed to the Google Groups "TensorFlow.js Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tfjs+uns...@tensorflow.org.
Visit this group at https://groups.google.com/a/tensorflow.org/group/tfjs/.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tfjs/74bc3c2c-9e2b-46e4-9f9f-cbbbca2754ea%40tensorflow.org.

Daniel Smilkov

unread,
Jan 8, 2019, 10:41:27 PM1/8/19
to Nikhil Thorat, Shanqing Cai, TensorFlow.js Discussion
This is a very cool project. Nice work François!

Wondering if you ran into any problems using tf.js inside a WebWorker? And also curious what the performance is of the original WASM backend vs the tf.js one.

Best,
Daniel


François Pays

unread,
Jan 18, 2019, 7:33:16 AM1/18/19
to TensorFlow.js Discussion
Sorry for the delay.

Yes, running tensorflowjs in a worker is still a little challenging. Some browsers support offScreen canvas, some other don’t. For some, it’s an option the user enables. Even when OffScreen canvas is supported, I had to fake the creation of the canvas (issue 102), and also supplement a function missing in firefox workers. Look at main.js for details.

I was able to port the native BLAS backend to wasm but only after replacing the sgemm routine with very naive implementations. It works for debugging purposes but no wonder it’s very slow. Nonetheless it achieves 62 nodes/sec compared with 960 nodes/sec using tensorflowjs.

Best,
Francois

Daniel Smilkov

unread,
Jan 22, 2019, 8:22:00 PM1/22/19
to François Pays, Yannick Assogba, TensorFlow.js Discussion
Thanks François! This is valuable feedback. We'll make sure to move those tweaks into the library so it is much smoother to use tfjs-core in a WebWorker.

Daniel


--
You received this message because you are subscribed to the Google Groups "TensorFlow.js Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tfjs+uns...@tensorflow.org.
Visit this group at https://groups.google.com/a/tensorflow.org/group/tfjs/.

sridhar vijendran

unread,
Jun 21, 2019, 5:26:42 AM6/21/19
to TensorFlow.js Discussion
Hi,

How did you port the Leela Chess Zero network to tensorflowjs ?

Thanks,
Sridhar
Reply all
Reply to author
Forward
0 new messages