Giter Club home page Giter Club logo

ezkl's Introduction


๐Ÿ’ญ

EZKL


Easy Zero-Knowledge Inference

Test

ezkl is a library and command-line tool for doing inference for deep learning models and other computational graphs in a zk-snark (ZKML). It enables the following workflow:

  1. Define a computational graph, for instance a neural network (but really any arbitrary set of operations), as you would normally in pytorch or tensorflow.
  2. Export the final graph of operations as an .onnx file and some sample inputs to a .json file.
  3. Point ezkl to the .onnx and .json files to generate a ZK-SNARK circuit with which you can prove statements such as:

"I ran this publicly available neural network on some private data and it produced this output"

Notebook

"I ran my private neural network on some public data and it produced this output"

Notebook

"I correctly ran this publicly available neural network on some public data and it produced this output"

Notebook

In the backend we use Halo2 as a proof system.

The generated proofs can then be used on-chain to verify computation, only the Ethereum Virtual Machine (EVM) is supported at the moment.

  • If you have any questions, we'd love for you to open up a discussion topic in Discussions. Alternatively, you can join the โœจEZKL Community Telegram Group๐Ÿ’ซ.

  • For more technical writeups and details check out our blog.

  • To see what you can build with ezkl, check out cryptoidol.tech where ezkl is used to create an AI that judges your singing ... forever.


getting started โš™๏ธ

Python

Install the python bindings by calling.

pip install ezkl

Or for the GPU:

pip install ezkl-gpu

Google Colab Example to learn how you can train a neural net and deploy an inference verifier onchain for use in other smart contracts. Notebook

More notebook tutorials can be found within examples/notebooks.

CLI

Install the CLI

curl https://hub.ezkl.xyz/install_ezkl_cli.sh | bash
ezklxdemo.mp4

For more details visit the docs.

Build the auto-generated rust documentation and open the docs in your browser locally. cargo doc --open

building the project ๐Ÿ”จ

Rust CLI

You can install the library from source

cargo install --locked --path .

You will need a functioning installation of solc in order to run ezkl properly. solc-select is recommended. Follow the instructions on solc-select to activate solc in your environment.

building python bindings

Python bindings exists and can be built using maturin. You will need rust and cargo to be installed.

python -m venv .env
source .env/bin/activate
pip install -r requirements.txt
maturin develop --release --features python-bindings
# dependencies specific to tutorials
pip install torch pandas numpy seaborn jupyter onnx kaggle py-solc-x web3 librosa tensorflow keras tf2onnx

GPU Acceleration

If you have access to NVIDIA GPUs, you can enable acceleration by building with the feature icicle and setting the following environment variable:

export ENABLE_ICICLE_GPU=true

GPU acceleration is provided by Icicle

To go back to running with CPU, the previous environment variable must be unset instead of being switch to a value of false:

unset ENABLE_ICICLE_GPU

NOTE: Even with the above environment variable set, icicle is disabled for circuits where k <= 8. To change the value of k where icicle is enabled, you can set the environment variable ICICLE_SMALL_K.

repos

The EZKL project has several libraries and repos.

Repo Description
@zkonduit/ezkl the main ezkl repo in rust with wasm and python bindings
@zkonduit/ezkljs typescript and javascript tooling to help integrate ezkl into web apps

contributing ๐ŸŒŽ

If you're interested in contributing and are unsure where to start, reach out to one of the maintainers:

  • dante (alexander-camuto)
  • jason (jasonmorton)

More broadly:

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be licensed to Zkonduit Inc. under the terms and conditions specified in the CLA, which you agree to by intentionally submitting a contribution. In particular, you have the right to submit the contribution and we can distribute it under the Apache 2.0 license, among other terms and conditions.

no security guarantees

Ezkl is unaudited, beta software undergoing rapid development. There may be bugs. No guarantees of security are made and it should not be relied on in production.

NOTE: Because operations are quantized when they are converted from an onnx file to a zk-circuit, outputs in python and ezkl may differ slightly.

ezkl's People

Contributors

alexander-camuto avatar jasonmorton avatar ethan-crypto avatar jseam2 avatar lltuo avatar lancenonce avatar dcbuild3r avatar sid-alluri avatar currenthandle avatar weijiekoh avatar field-worker avatar distributedstatemachine avatar gagichce avatar huitseeker avatar genysys avatar neurone avatar jeremyfelder avatar saeyoon17 avatar vid201 avatar dependabot[bot] avatar glazec avatar hadiesna avatar xiaolou86 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.