Keras2circom
python tool to transpile a tf.keras model into a circom circuit
Install / Use
/learn @socathie/Keras2circomREADME
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
Related Skills
node-connect
350.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
350.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
350.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
