Giter Site home page Giter Site logo

hybrid-approach-to-ppfl's Introduction

PoC Hybrid Approach

Project structure

  • main.py -- script for MNIST experiment (either Linear or CNN model). Defines dataset and dataloaders for trainer
  • rnn_main.py -- script for RNN experiment
  • trainer.py -- Trainer class that rules training and encryption stuff
  • distro.py -- Party and Server classes that knows about model and about encryption and do it
  • distro_paillier/ -- sources of Threshold Paillier Homomorphic Encryption. this library is used. I've done minor changes to decrypt function for it to work correctly with float numbers.
  • config.py -- containes singleton config object used by all modules.

How to run

  1. Install system dependencies for crypto stuff: sudo apt install libgmp-dev libmpfr-dev libmpc-dev.
  2. Install python dependencies: pip install -r requirements.txt.
  3. Run MNIST experiment python main.py.
  4. Run RNN experiment python rnn_main.py.

hybrid-approach-to-ppfl's People

Contributors

lainisourgod avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

hybrid-approach-to-ppfl's Issues

aggregate_params err

(hybrid) ubuntu@ubuntu-SYS-7049GP-TRTA-AI034:Workspace/hybrid-approach-to-ppfl$ python main.py
Bit-length of primes: 128
Starting generation of p, q and N...
Generation successful.
Number of insuccesfull trials small prime test: 1330
Number of insuccesfull trials biprime test: 16
Elapsed time: 1 seconds.
Traceback (most recent call last):
File "Workspace/hybrid-approach-to-ppfl/main.py", line 84, in
trainer.fit()
File "Workspace/hybrid-approach-to-ppfl/train.py", line 72, in fit
self.fit_on_batch()
File "Workspace/hybrid-approach-to-ppfl/train.py", line 97, in fit_on_batch
aggregate: np.ndarray = self.server.aggregate_params(encrypted_models)
File "Workspace/hybrid-approach-to-ppfl/distro.py", line 72, in aggregate_params
return np.mean(gradients_of_parties, axis=0)
File "<array_function internals>", line 200, in mean
File "/home/ubuntu/anaconda3/envs/hybrid/lib/python3.9/site-packages/numpy/core/fromnumeric.py", line 3464, in mean
return _methods._mean(a, axis=axis, dtype=dtype,
File "/home/ubuntu/anaconda3/envs/hybrid/lib/python3.9/site-packages/numpy/core/_methods.py", line 165, in _mean
arr = asanyarray(a)
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 2 dimensions. The detected shape was (10, 2) + inhomogeneous part.

keyword-only arguments missing

Error when running main.py

Bit-length of primes:  128
Starting generation of p, q and N...
Generation successful.
Number of insuccesfull trials small prime test:  323
Number of insuccesfull trials biprime test:  4
Elapsed time:  0 seconds.
Traceback (most recent call last):
  File "main.py", line 77, in <module>
    trainer = Trainer(
  File "/home/student/Desktop/hybrid-approach-to-ppfl-master/train.py", line 40, in __init__
    self.configure_system()
  File "/home/student/Desktop/hybrid-approach-to-ppfl-master/train.py", line 50, in configure_system
    self.parties = [
  File "/home/student/Desktop/hybrid-approach-to-ppfl-master/train.py", line 51, in <listcomp>
    Party(model=self.model, pubkey=self.server.pubkey)
  File "/home/student/Desktop/hybrid-approach-to-ppfl-master/distro.py", line 109, in __init__
    self.randomiser = dp.mechanisms.Gaussian().set_epsilon_delta(1, 1).set_sensitivity(0.1)
TypeError: __init__() missing 3 required keyword-only arguments: 'epsilon', 'delta', and 'sensitivity'

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.