Py2wasm – A Python to WASM Compiler
wasmer.io
Py2wasm – A Python to WASM Compiler
1–10 of 175 posts
Re: Py2wasm – A Python to WASM Compiler
#2Re: Py2wasm – A Python to WASM Compiler
#3Nice. Maybe a pie in the sky but considering how prevalent python is in machine learning, how likely is it that at some point most ML frameworks written in python become executable on a web browser through WASM?
Re: Py2wasm – A Python to WASM Compiler
#4Nice. Maybe a pie in the sky but considering how prevalent python is in machine learning, how likely is it that at some point most ML frameworks written in python become executable on a web browser through WASM?
The question is do the web browsers and WebAssembly have enough RAM to do any meaningful machine learning work.
Re: Py2wasm – A Python to WASM Compiler
#5Nice. Maybe a pie in the sky but considering how prevalent python is in machine learning, how likely is it that at some point most ML frameworks written in python become executable on a web browser through WASM?
But with the right tool chain, you already can do this. You can use Pyodide to embed a Python interpreter in WASM, and if you set things up correctly you should be able to make the underlying C/FORTRAN/whatever extensions target WASM also and link them up.
TFA is compiling a subset of actual raw Python to WASM (no extension). To be honest, I think applications for this are pretty niche. I don't think Python is a super ergonomic language once you remove all the dynamicity to allow it to compile down. But maybe someone can prove me wrong.
Re: Py2wasm – A Python to WASM Compiler
#6Re: Py2wasm – A Python to WASM Compiler
#7This is clearly written in the article, but I hope that the impatient readers will understand that this is 3 times faster than the CPython wasm, not the native CPython.
Re: Py2wasm – A Python to WASM Compiler
#8Nice. Maybe a pie in the sky but considering how prevalent python is in machine learning, how likely is it that at some point most ML frameworks written in python become executable on a web browser through WASM?
The actual underlying models run in a lower-level language (not Python). But with the right tool chain, you already can do this. You can use Pyodide to embed a Python interpreter in WASM, and if you set things up correctly you should be able to make the underlying C/FORTRAN/whatever extensions target WASM also and link them up. TFA is compiling a subset of actual raw Python to WASM (no extension). To be honest, I thi…
One of the issues you'll run into is that Pyodide only works by default with packages that have pure Python wheels available. The team has developed support for some libraries with C dependencies (like scikit-learn, I believe), but frameworks like PyTorch are particularly thorny (see this issue: https://github.com/pyodide/pyodide/issues/1625 )
We ended up rolling out a new version of our Python visualizations that runs off-browser, in order to support enough libraries/get the performance we need: https://www.comet.com/docs/v2/guides/comet-ui/experiment-man...
Re: Py2wasm – A Python to WASM Compiler
#9Nice. Maybe a pie in the sky but considering how prevalent python is in machine learning, how likely is it that at some point most ML frameworks written in python become executable on a web browser through WASM?
Re: Py2wasm – A Python to WASM Compiler
#10> py2wasm converts your Python programs to WebAssembly, running them at 3x faster speeds This is clearly written in the article, but I hope that the impatient readers will understand that this is 3 times faster than the CPython wasm, not the native CPython.