An open API service indexing awesome lists of open source software.

https://github.com/muna-ai/muna-py

Run AI models anywhere. https://muna.ai/explore
https://github.com/muna-ai/muna-py

ai deep-learning machine-learning numpy pytorch serverless serverless-gpu

Last synced: 1 day ago
JSON representation

Run AI models anywhere. https://muna.ai/explore

Awesome Lists containing this project

README

          

# Muna for Python

![muna transpile](https://github.com/user-attachments/assets/06490612-17aa-4e42-b5e2-61afdfe3d58a)

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:
```sh
# 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`](https://docs.muna.ai/predictors/create) decorator to your function:
```py
from muna import compile

@compile()
def do_stuff():
...
```

Then use the Muna CLI to transpile to C++:
```sh
# 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`.

> [!TIP]
> Even though the compiler is not open-source, you can [read up on how it works](https://blog.codingconfessions.com/p/compiling-python-to-run-anywhere).

Once compiled, you can then build the included example app and test it from the command line. Here's an example using
[Kokoro TTS](https://github.com/muna-ai/muna-predictors/blob/main/text-to-speech/kokoro.py) 🔊:

https://github.com/user-attachments/assets/a0090414-bb9d-4b69-8876-959bd60c699a

___

## Useful Links
- [Check out several AI models we've compiled](https://github.com/muna-ai/muna-predictors).
- [Join our Slack community](https://muna.ai/slack).
- [Check out our docs](https://docs.muna.ai).
- Learn more about us [on our blog](https://blog.muna.ai).
- Reach out to us at [hi@muna.ai](mailto:hi@muna.ai).

Muna is a product of [NatML Inc](https://github.com/natmlx).