Skip to content

ora-io/keras2circom

Repository files navigation

keras2circom

keras2circom is a python tool that transpiles a tf.keras model into a circom circuit.

Installation

First, clone the repository:

git clone https://github.com/socathie/keras2circom.git

Then, install the dependencies. You can use pip:

pip install -r requirements.txt

If you use conda, you can also create a new environment with the following command:

conda env create -f environment.yml

You will also need to install circom and snarkjs. You can run the following commands to install them:

bash setup-circom.sh

Last but not least, run

npm install

Usage

To use the package, you can run the following command:

python main.py <model_path> [-o <output_dir>] [--raw]

For example, to transpile the model in models/model.h5 into a circom circuit, you can run:

python main.py models/model.h5

The output will be in the output directory.

If you want to transpile the model into a circom circuit with "raw" output, i.e. no ArgMax at the end, you can run:

python main.py models/model.h5 --raw

Testing

To test the package, you can run the following command:

npm test

About

python tool to transpile a tf.keras model into a circom circuit

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published