Giter Site home page Giter Site logo

fedtts's Introduction

Federated Transferrable Training Schema (FedTTS) & FedAvg

Implementation of Federated Transferrable Training Schema and the vanilla federated learning paper : Communication-Efficient Learning of Deep Networks from Decentralized Data.

Experiments are produced on MNIST, Fashion MNIST and CIFAR10 (both IID and non-IID). In case of non-IID, the data amongst the users can be split equally or unequally.

Since the purpose of these experiments are to illustrate the effectiveness of the federated learning paradigm, only simple models such as MLP and CNN are used.

Requirments

Install all the packages from requirments.txt

  • Python3
  • Pytorch
  • Torchvision

Data

  • Download train and test datasets manually or they will be automatically downloaded from torchvision datasets.
  • Experiments are run on Mnist, Fashion Mnist and Cifar.
  • To use your own dataset: Move your dataset to data directory and write a wrapper on pytorch dataset class.

Running the experiments

The baseline experiment trains the model in the conventional way.

  • To run the FedAvg with CNN model:
python federated_main.py \
				--model=cnn \
        --dataset=mnist \
        --local_ep=5 \
        --epochs=800 \
        --target_accuracy=0.98 \
        --eval_every=2 \
        --local_bs=10 \
        --frac=0.1 \
        --eval_after=300 \
        --local_algo=FedAvg \
        --n_cluster=5 \
        --r_overlapping=0 \
        --gamma=0.5 \
        --n_transfer=5 \
        --config_file=./config/fedtts-conf.yaml \
        --eid=1 \
        --verbose=0
  • To run the FedTTS with CNN model:
python federated_main.py \
				--model=cnn \
        --dataset=mnist \
        --local_ep=5 \
        --epochs=800 \
        --target_accuracy=0.98 \
        --eval_every=2 \
        --local_bs=10 \
        --frac=0.1 \
        --eval_after=100 \
        --local_algo=FedTTS \
        --n_cluster=4 \
        --r_overlapping=0 \
        --gamma=0.5 \
        --n_transfer=5 \
        --config_file=./config/fedtts-conf.yaml \
        --eid=2 \
        --verbose=0

You can change the default values of other parameters to simulate different conditions.

Further Readings

Papers:

Blog Posts:

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.