Coder Social home page Coder Social logo

liuyuqinggg / pfedla Goto Github PK

View Code? Open in Web Editor NEW

This project forked from karhoutam/pfedla

0.0 1.0 0.0 26 KB

PyTorch implementation of Layer-wised Model Aggregation for Personalized Federated Learning

Home Page: https://arxiv.org/abs/2205.03993

License: MIT License

Shell 3.76% Python 96.24%

pfedla's Introduction

pFedLA(HeurpFedLA), FedAvg, FedBN

NOTE: This's not the official Repo.

So maybe some hyperparameters not mentioned in paper aren't optimal.

All datasets mentioned in paper are supported(CIFAR10, ...).

If you find sth wrong about the code, feel free to open an issue or pr.

Run

Generating clients dataset

Segmenting by Dirichlet($\alpha$) and Randomly assigning classes are supported.

E.g.

python ./src/data/run.py --dataset cifar10 --classes 4 --client_num_in_total 10

Check ./src/data/run.py for more Info of all arguments.

Training

Scripts for running pFedLA with fixed args are in ./scripts

cd ./scripts;
chmod +x ./*;
sh ${script}

Also, you can directly run python ./src/server/${algo}.py with your custom arguments after generate clients dataset.

Arguments

Name Description
k Blocks retained by client in each round. Specifically for HeurpFedLA.
global_epochs Communication rounds.
local_epochs Client local training epochs.
local_lr Client local optimizer's learning rate.
hn_lr Learning rate for each client's hypernetwork.
verbose_gap Logger report training results of selected clients after every verbose_gap communication rounds.
embedding_dim Size of each client's embedding.
hidden_dim Size of hidden layers in each client's hypernetwork.
dataset Used dataset's name.
batch_size Batch size for local training and test.
valset_ratio Ratio of validation set.
testset_ratio Ratio of test set.
gpu Set as non-zero value for using cuda.
log Set at non-zero value for saving log file in ./logs .
seed Random seed for running experiment.
save_period Temporarily save clients model parameters after every save_period communication rounds.

pfedla's People

Contributors

karhoutam avatar

Watchers

James Cloos 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.