Skip to content

This repository is a base template for Federated Learning build using Flower with Aviation Dataset.

Notifications You must be signed in to change notification settings

Barathwaja/federated-learning

Repository files navigation

Federated-CPS

About this Repo

This repository is a base template for Federated Learning build using Flower. Current setup uses LSTM and k-Means with Federated Average for the prediction of geo-altitude for Aviation Dataset.

Pre-requisite

  • Docker Engine with (WSL Enabled on Windows)
  • Any Code Editor

Folder Structure

.
├── client-1..N             # Code containing the ML/DL algo. in FL setting (acts as FL clients)
├── server                  # Code containing the ML/DL algo. in FL setting (acts as FL server)
├── monitoring              # Code containing the Grafana, Prometheus configuration
├── single-client           # Code containing the ML/DL algo. without FL setting
├── dataset                 # Contains the raw and processed dataset of the aircraft
├── misc                    
└── README.md

Steps to Run

Below are the setup that needs to be done in sequence.

1. Configuration

  • Create a SUBNET with a name inside docker using the command: (One-Time Only)
    docker network create --subnet 192.0.0.100/24 <name-of-subnet>

2. Setting Docker Image

  • To create the image of federated server
    cd server && docker build -t <name-of-image> .
    (i.e) cd server && docker build -t fl-server .

  • To create the image of federated clients
    cd client-1 && docker build -t <name-of-image> .
    (i.e) cd client-1 && docker build -t fl-client-1 .

Note: Perform the same for N-Clients.

3. Running the Docker Image as Docker Container

  • [Optional] To run the monitoring tools
    To Start Service: cd monitoring && docker-compose up -d
    To Stop Service: cd monitoring && docker-compose down

  • To run the federated server
    docker run -d --network=<name-of-subnet> --ip=<any-IP-within-subnet> --name=<custom-name> <name-of-image>
    (i.e) docker run -d --network=custom-net --ip=192.0.0.101 --name=fl-server fl-server --num_rounds=<any-number>

  • To run the federated client-1
    docker run -d --network=<name-of-subnet> --ip=<any-IP-within-subnet-for-client> --name=<custom-name> <name-of-image> --ip=<give-IP-of-FedServer --epochs=<number-of-iter> --folder=<dataset-folder>
    (i.e) docker run -d --network=custom-net --ip=192.0.0.102 --name=fl-client-2 fl-client-2 --ip=192.0.0.101 --epochs=10 --folder=batch

Note: Perform the same for N-Clients. Donot change the PORT as it is pre-configured inside

Arguments

-d : Run in detached mode (in background)

About

This repository is a base template for Federated Learning build using Flower with Aviation Dataset.

Topics

Resources

Stars

Watchers

Forks