keras2circom  by socathie

Keras model to Circom circuit transpiler

Created 2 years ago
250 stars

Top 100.0% on SourcePulse

GitHubView on GitHub
Project Summary

This tool transpiles TensorFlow Keras models into Circom circuits, enabling the deployment of neural networks within zero-knowledge proofs. It targets developers and researchers in the ZKML (Zero-Knowledge Machine Learning) space looking to integrate ML models into blockchain or privacy-preserving applications.

How It Works

The tool parses a saved Keras model (.h5 format) and translates its layers and operations into equivalent Circom components. This allows for the execution of neural network inference within a ZK-SNARK-friendly arithmetic circuit, facilitating verifiable computation.

Quick Start & Requirements

  • Install dependencies: pip install -r requirements.txt or conda env create -f environment.yml.
  • Install Circom and snarkjs: bash setup-circom.sh and npm install.
  • Run transpilation: python main.py <model_path> [-o <output_dir>] [--raw]
  • Requires Python 3.x, TensorFlow, and Node.js.

Highlighted Details

  • Transpiles tf.keras models to Circom.
  • Supports raw output without ArgMax.
  • Includes a testing suite via npm test.

Maintenance & Community

No specific community channels or roadmap are detailed in the README.

Licensing & Compatibility

The repository does not explicitly state a license. Compatibility for commercial use or closed-source linking is undetermined.

Limitations & Caveats

The README does not specify which Keras layers are supported or provide performance benchmarks. The tool appears to be in early development, with potential limitations on model complexity and supported operations.

Health Check
Last Commit

1 year ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
0 stars in the last 30 days

Explore Similar Projects

Starred by Travis Addair Travis Addair(Cofounder of Predibase), Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), and
10 more.

hummingbird by microsoft

0.0%
3k
Compiler for trained ML models into tensor computation
Created 5 years ago
Updated 2 months ago
Starred by François Chollet François Chollet(Author of Keras; Cofounder of Ndea, ARC Prize) and Omar Sanseviero Omar Sanseviero(DevRel at Google DeepMind).

keras-hub by keras-team

0.6%
932
Pretrained model hub for Keras 3
Created 5 years ago
Updated 1 day ago
Feedback? Help us improve.