PyTorch framework for building, testing and benchmarking Binarised Neural Networks (BNNs), which can be converted into Fully Homomorphic Encryption (FHE) versions to be executed on CONCRETE.
Warning: Much of the code pertaining to FHE is not functional, due to issues with bootstrapping in CONCRETE. Future versions of CONCRETE may address this problem, but would require significant modifications to the code.
First install Poetry. Dependencies for
the doren_bnn
package can now be installed in a virtual environment with the following
command:
poetry install
To view Jupyter notebooks with nbdime
, configure
the diff/merge drivers for this repository with the following command:
nbdime config-git --enable
To enable the use of Git pre-commit hooks, install the
pre-commit
package with the following command:
pre-commit install
To set up the Concrete library, please follow the instructions at [https://docs.zama.ai/concrete/lib/user/installation.html]. Take note that the library is only supported on macOS and Linux.
Note: Currently, it seems that compilation only works on Nightly Rust and not stable.
To run the executable in the library, run the following commands from the root directory:
cd doren_bnn_concrete
RUSTCFLAGS="target-cpu=native" cargo run --release
To build and install the Python bindings, run the following commands from the root directory:
cd doren_bnn_concrete
RUSTCFLAGS="target-cpu=native" maturin develop --release
You can now import the package doren_bnn_concrete
from the root directory.