Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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:

  1. Python: Ensure Python 3.9.6 or newer is installed.

    • Check by running:
    python3 --version
    
    • If not installed, follow the instructions here.
  2. Leo: Ensure Leo version 1.9.3 or newer is installed.

    • Check by running:
    leo --version
    
    • If necessary, update:
    leo update
    
  3. 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:

  1. Clone the repository, or download the .whl or .tar.gz file from the dist folder.
  2. Navigate to the dist directory containing the .whl or .tar.gz file:
    cd dist
    
  3. Install using pip:
    pip3 install zkml-0.0.1b1-py3-none-any.whl
    
    OR
    pip3 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 the examples folder by running:
    pip3 install -r requirements.txt
    
  • The examples demonstrate how to work with the Python to Leo transpiler. Currently, the transpiler supports scikit-learn decision tree and multilayer perceptron neural network 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:

    1. Visual Studio Code (VS Code)

    2. Jupyter Notebook

      • Ensure you have Jupyter Notebook installed.
      • Navigate to the examples folder in a terminal and launch Jupyter Notebook using the command jupyter 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:

  1. Clone the repository.
  2. Ensure no previous version of zkml is installed:
    pip3 uninstall zkml
    
  3. Navigate to the zkml source code directory:
    cd zkml
    
  4. 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!

Release files for zkml 0.0.2b2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zkml 0.0.2b2
File Size Uploaded
zkml-0.0.2b2.tar.gz 28.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for zkml 0.0.2b2
File Interpreter ABI Platform
zkml-0.0.2b2-py3-none-any.whl Python 3 none any Details

Total release size: 57.9 kB

Release files / zkml-0.0.2b2.tar.gz

Download URL zkml-0.0.2b2.tar.gz
Size 28.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ec2677989c69c9f25cf4555c449b7beb81c867badc95a442d805ff2b7e2ff95e
BLAKE2b-256 checksum
How to use checksums
3e432054d0991ecf710ff196daa9be52294fe3a0c31d495fe0aa0dc708352093
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.4

Release files / zkml-0.0.2b2-py3-none-any.whl

Download URL zkml-0.0.2b2-py3-none-any.whl
Size 29.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ddd886908235fde0ce11936dbcffbff338ae78d92def6ed029bd97077bcaea06
BLAKE2b-256 checksum
How to use checksums
353cfad48606c29ca620577672bc5b1691707e990c4ca8dc7b8b7902a96ad0b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.4
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page