A transpiler for Python machine learning models to Leo for zero-knowledge inference
Project description
Python to Leo: Machine Learning Model Transpiler
This Python library offers the ability to transpile Python machine learning models into Leo code. Additionally, it provides tools to execute the transpiled code from Python and to generate zk proofs.
🚀 Getting Started for Users (Python ML Developers)
Prerequisites:
-
Python: Ensure Python 3.9.6 or newer is installed.
- Check by running:
python3 --version
- If not installed, follow the instructions here.
-
Leo: Ensure Leo version 1.9.3 or newer is installed.
- Check by running:
leo --version
- If necessary, update:
leo update
- Installation guide: Leo Installation
-
Confirm you're on the master branch of GitHub (you should be by default).
Installation:
Through PyPI:
- Install using the following command:
pip3 install zkml
Through the GitHub repository:
- Clone the repository, or download the
.whl
or.tar.gz
file from thedist
folder. - Navigate to the
dist
directory containing the.whl
or.tar.gz
file:cd dist
- Install using pip:
pip3 install zkml-0.0.1b1-py3-none-any.whl
ORpip3 install zkml-0.0.1b1.tar.gz
Usage:
- Explore the
examples
folder from GitHub for example usages. To run the examples, additional Python packages are required. You can install these from theexamples
folder by running:pip3 install -r requirements.txt
- The examples demonstrate how to work with the Python to Leo transpiler. Currently, the transpiler supports sklearn decision tree models, and the examples cover the Iris dataset, the German credit dataset, and the MNIST dataset.
Notes:
-
On some systems, "python" and "pip" might be used instead of "python3" and "pip3".
-
In case you are unfamiliar with Jupyter notebooks, here are two ways to run these notebooks:
-
Visual Studio Code (VS Code)
- Ensure you have VS Code installed.
- Install the Jupyter extension in VS Code.
- Open the notebook file (
.ipynb
) in VS Code to view, edit, and run the Python code cells interactively.
-
Jupyter Notebook
- Ensure you have Jupyter Notebook installed.
- Navigate to the
examples
folder in a terminal and launch Jupyter Notebook using the commandjupyter notebook
. - Once Jupyter Notebook launches in your browser, open the notebook files (
.ipynb
) to view and run the Python code cells interactively.
For a more detailed tutorial on using Jupyter Notebooks, refer to this Jupyter Notebook beginner guide.
-
🛠 Guide for Library Developers
Setup:
- Clone the repository.
- Ensure no previous version of
zkml
is installed:pip3 uninstall zkml
- Navigate to the
zkml
source code directory:cd zkml
- Install in editable mode:
pip3 install -e .
Contribution guidelines:
Please follow the contribution guidelines outlined here. For efficient workflows, we also encourage you to get in touch with the developers prior to contributing.
Thank you for your interest in the zkml Python to Leo transpiler. Let's push the boundaries of zk and Python together!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file zkml-0.0.2b1.tar.gz
.
File metadata
- Download URL: zkml-0.0.2b1.tar.gz
- Upload date:
- Size: 20.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0520fa502eedc58cc054ecfba9cf959dbfee2ca32f5589debcab2b472f451641 |
|
MD5 | 0ff78c38bc7282b581be7c888ad0d180 |
|
BLAKE2b-256 | 316e1ab7fa1d5ed4ccd7ed9cf7867e9b4cc861d1cfb0bd82a423eff747b9ef01 |
File details
Details for the file zkml-0.0.2b1-py3-none-any.whl
.
File metadata
- Download URL: zkml-0.0.2b1-py3-none-any.whl
- Upload date:
- Size: 25.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d1ac92dc1d7755dbbac5df4013174267aadbd2f2f81c9ede30789ec4359d258 |
|
MD5 | b61714356fc998d910e4d1adef4fc632 |
|
BLAKE2b-256 | 6cc61c3c10061f4a80c3e2b60c6e06864ea1b98a88fd10370ca372c17e22545e |