Git Product home page Git Product logo

cl-project's Introduction

FedFromScratch

header This repository contains the code for the project "Federated Learning from Scratch" for the course "Continual Learning" at the University of Pisa

Project structure

.
├── README.md
├── histories
│   ├── history_5e10c.pkl
│   ├── history_5e10c_fashion.pkl
│   ├── history_5e128c.pkl
│   ├── history_5e20c.pkl
│   ├── history_5e5c.pkl
│   └── history_niid.pkl
├── models
│   ├── efficientnet_b0.pth
│   ├── efficientnet_cifar10.pth
│   ├── mnist_cnn_model.pth
│   ├── model5e10c_fashion.pth
│   ├── model_niid.pth
│   └── resnet18_cifar10.pth
├── requirements.txt
└── src
    ├── federated.py
    ├── finetuning.py
    ├── models.py
    ├── report.ipynb
    └── utils.py

How to run the code

To run the code, you need to first install the required packages. You can do this by running the following command:

pip install -r requirements.txt

After that, you can run the code by running the following command:

python src/fedmnist.py [--help]

The script will train a federated model on the MNIST dataset. You can specify the number of clients, the number of epochs, the batch size, the learning rate, the optimizer, the model, and the dataset.

usage: fedmnist.py [-h] [--n_clients N_CLIENTS] [--local_epochs LOCAL_EPOCHS] [--lr LR] [--n_samples N_SAMPLES] [--device DEVICE] [--weight_decay WEIGHT_DECAY] [--iid IID] [--rounds ROUNDS] [--jobs JOBS]

FedMNIST

options:
  -h, --help            show this help message and exit
  --n_clients N_CLIENTS
                        number of clients to initialize
  --local_epochs LOCAL_EPOCHS
                        number of local epochs
  --lr LR               learning rate
  --n_samples N_SAMPLES
                        number of samples per client
  --device DEVICE       device to train on
  --weight_decay WEIGHT_DECAY
                        weight decay for optimizer
  --iid IID             whether to sample clients iid or not
  --rounds ROUNDS       number of rounds to train for
  --jobs JOBS           number of jobs to run in parallel

Results

Results of the experiments are reported in the norebook report.ipynb.

cl-project's People

Contributors

vornao avatar

Watchers

 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.