GithubHelp home page GithubHelp logo

will8898 / he-transformer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nervanasystems/he-transformer

0.0 1.0 0.0 94.86 MB

nGraph-HE: Deep learning with Homomorphic Encryption (HE) through Intel nGraph

License: Apache License 2.0

CMake 3.94% C++ 90.44% Shell 3.68% Makefile 1.09% Python 0.86%

he-transformer's Introduction

HE Transformer for nGraph

The Intel® HE transformer for nGraph™ is a Homomorphic Encryption (HE) backend to the Intel® nGraph Compiler, Intel's graph compiler for Artificial Neural Networks.

Homomorphic encryption is a form of encryption that allows computation on encrypted data, and is an attractive remedy to increasing concerns about data privacy in the field of machine learning. For more information, see our original paper. Our updated paper showcases many of the recent advances in he-transformer.

This project is meant as a proof-of-concept to demonstrate the feasibility of HE on local machines. The goal is to measure performance of various HE schemes for deep learning. This is not intended to be a production-ready product, but rather a research tool.

Currently, we support the CKKS encryption scheme, implemented by the Simple Encrypted Arithmetic Library (SEAL) from Microsoft Research.

Additionally, we integrate with the Intel® nGraph™ Compiler and runtime engine for TensorFlow to allow users to run inference on trained neural networks through Tensorflow.

Examples

The examples folder contains a deep learning example which depends on the Intel® nGraph™ Compiler and runtime engine for TensorFlow.

Building HE Transformer

Dependencies

  • Operating system: Ubuntu 16.04, Ubuntu 18.04.
  • CMake >= 3.12
  • Compiler: g++ version >= 6.0, clang >= 5.0
  • OpenMP is strongly suggested, though not strictly necessary. You may experience slow runtimes without OpenMP
  • python3 and pip3
  • virtualenv v16.1.0
  • bazel v0.25.2

The following dependencies are built automatically

We also offer docker containers and builds of he-transformer on a reference OS.

To install bazel

    wget https://github.com/bazelbuild/bazel/releases/download/0.25.2/bazel-0.25.2-installer-linux-x86_64.sh
    bash bazel-0.25.2-installer-linux-x86_64.sh --user

Add and source the bin path to your ~/.bashrc file to call bazel

 export PATH=$PATH:~/bin
 source ~/.bashrc

1. Build HE-Transformer

Before building, make sure you deactivate any active virtual environments (i.e. run deactivate)

git clone https://github.com/NervanaSystems/he-transformer.git
cd he-transformer
export HE_TRANSFORMER=$(pwd)
mkdir build
cd $HE_TRANSFORMER/build
cmake .. -DCMAKE_CXX_COMPILER=g++-7 -DCMAKE_C_COMPILER=gcc-7
make install
source external/venv-tf-py3/bin/activate

1a. To build documentation

First install doxygen, i.e.

sudo apt-get install doxygen

Then add the following CMake flag

cmake .. -DNGRAPH_HE_DOC_BUILD_ENABLE=ON

and call

make doc

to create doxygen documentation in $HE_TRANSFORMER/build/doc/doxygen.

1b. Python bindings for client

To build an experimental client-server model with python bindings, see the python folder. Note: This feature is experimental. For best experience, you should skip this step.

2. Run C++ unit-tests

Ensure the virtual environment is active, i.e. run source $HE_TRANSFORMER/build/external/venv-tf-py3/bin/activate

cd $HE_TRANSFORMER/build
# To run single HE_SEAL unit-test
./test/unit-test --gtest_filter="HE_SEAL.add_2_3"
# To run all C++ unit-tests
./test/unit-test

3. Run Simple python example

Ensure the virtual environment is active, i.e. run source $HE_TRANSFORMER/build/external/venv-tf-py3/bin/activate

cd $HE_TRANSFORMER/examples
# Run with CPU
python ax.py
# To run CKKS unit-test
NGRAPH_TF_BACKEND=HE_SEAL python ax.py

For a deep learning example, see examples/MNIST/Cryptonets/.

Code formatting

Please run maint/apply-code-format.sh before submitting a pull request.

he-transformer's People

Contributors

fboemer avatar yxlao avatar lorepieri8 avatar jopasserat avatar mlayou avatar r-kellerm avatar rsandler00 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.