Muna for Python
Run AI models anywhere.
Installing Muna
Muna is distributed on PyPi. This distribution contains both the Python client and the command line interface (CLI). Run the following command in terminal:
# Install Muna
$ pip install --upgrade muna
Note
Muna requires Python 3.11+
Transpiling a Python Function
Muna can transpile Python functions into C++, generating a self-contained header-only library that pulls all of its dependencies automatically (e.g. llama.cpp, mlx, CUDA). First, add the @compile decorator to your function:
from muna import compile
@compile()
def do_stuff():
...
Then use the Muna CLI to transpile to C++:
# Transpile the Python function to C++
$ muna transpile ...
Muna for Python
Run AI models anywhere.
Installing Muna
Muna is distributed on PyPi. This distribution contains both the Python client and the command line interface (CLI). Run the following command in terminal:
# Install Muna
$ pip install --upgrade muna
Note
Muna requires Python 3.11+
Transpiling a Python Function
Muna can transpile Python functions into C++, generating a self-contained header-only library that pulls all of its dependencies automatically (e.g. llama.cpp, mlx, CUDA). First, add the @compile decorator to your function:
from muna import compile
@compile()
def do_stuff():
...
Then use the Muna CLI to transpile to C++:
# Transpile the Python function to C++
$ muna transpile do_stuff.py
Muna will create a cloud sandbox to setup your Python function, trace it, lower to C++, then generate a folder containing the header-only library and a corresponding CMakeLists.txt.
Once compiled, you can then build the included example app and test it from the command line. Here’s an example using Kokoro TTS 🔊:
kokoro.mp4
Useful Links
- Check out several AI models we’ve compiled.
- Join our Slack community.
- Check out our docs.
- Learn more about us on our blog.
- Reach out to us at hi@muna.ai.
Muna is a product of NatML Inc.