Package: ezkl
:thought_balloon:EZKLEasy Zero-Knowledge Inferenceezklis 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:Define a computational graph, for instance a neural network (but really any arbitrary set of operations), as you would normally in pytorch or tensorflow.Export the final graph of operations as an.onnxfile and some sample inputs to a.jsonfile.Pointezklto the.onnxand.jsonfiles 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""I ran my private neural network on some public data and it produced this output""I correctly ran this publicly available neural network on some public data and it produced this output"In the backend we useHalo2as 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 inDiscussions. Alternatively, you can join the ✨EZKL Community Telegram Group💫.For more technical writeups and details check out ourblog.To see what you can build with ezkl, check outcryptoidol.techwhere ezkl is used to create an AI that judges your singing ... forever.getting started ⚙️PythonInstall the python bindings by calling.pipinstallezklOr for the GPU:pipinstallezkl-gpuGoogle Colab Example to learn how you can train a neural net and deploy an inference verifier onchain for use in other smart contracts.More notebook tutorials can be found withinexamples/notebooks.CLIInstall the CLIcurlhttps://raw.githubusercontent.com/zkonduit/ezkl/main/install_ezkl_cli.sh|bashhttps://user-images.githubusercontent.com/45801863/236771676-5bbbbfd1-ba6f-418a-902e-20738ce0e9f0.mp4For more details visit thedocs.Build the auto-generated rust documentation and open the docs in your browser locally.cargo doc --openbuilding the project 🔨Rust CLIYou can install the library from sourcecargoinstall--locked--path.You will need a functioning installation ofsolcin order to runezklproperly.solc-selectis recommended.
Follow the instructions onsolc-selectto activatesolcin your environment.building python bindingsPython bindings exists and can be built usingmaturin. You will needrustandcargoto be installed.python-mvenv.envsource.env/bin/activate
pipinstall-rrequirements.txt
maturindevelop--release--featurespython-bindings# dependencies specific to tutorialspipinstalltorchpandasnumpyseabornjupyteronnxkagglepy-solc-xweb3librosatensorflowkerastf2onnxGPU AccelerationIf you have access to NVIDIA GPUs, you can enable acceleration by building with the featureicicleand setting the following environment variable:exportENABLE_ICICLE_GPU=trueGPU acceleration is provided byIcicleTo go back to running with CPU, the previous environment variable must beunsetinstead of being switch to a value of false:unsetENABLE_ICICLE_GPUNOTE:Even with the above environment variable set, icicle is disabled for circuits where k <= 8. To change the value ofkwhere icicle is enabled, you can set the environment variableICICLE_SMALL_K.reposThe EZKL project has several libraries and repos.RepoDescription@zkonduit/ezklthe main ezkl repo in rust with wasm and python bindings@zkonduit/ezkljstypescript and javascript tooling to help integrate ezkl into web appscontributing 🌎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:See currently open issues for ideas on how to contribute.For PRs we use theconventional commitsnaming convention.To report bugs or request new featurescreate a new issue within Issuesto inform the greater community.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 theCLA, 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 guaranteesEzkl 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.