/flower-nodejs-client

Adaptation of the Python client of the Flower library in NodeJs

Primary LanguageJavaScriptApache License 2.0Apache-2.0

Flower NodeJs Client

Package that allows you to implement a Flower client in NodeJs in order to create federated learning with tensorflow.js.

Prerequisite

Install :

  • python >= 3.6
  • flower library : pip install flwr
  • nodejs
  • npm

How to use

Same usage as the Python version.
Create a client that override the client class and fill the 4 methods, like "example/tfjs_Client.js".

const {Client} = require('flower-client');

class Tfjs_Client extends Client{
    ...
}

Modify if necessary the "server.py" and run it.
Finally, run the clients by using start_tfjs_client.

const {start_tfjs_client} = require('flower-client');

const tfjs_client = new Tfjs_Client();
await start_tfjs_client('<ip>:<port>', tfjs_Client,);

Run the example

  • Clone repository
  • Get into the folder : cd <path to the folder>
  • Installation: npm i
  • Get into the folder example: cd example
  • Run the server : python server.py
  • Run client#1 : node index.js
  • Run client#2 : node index.js