Official code implementation for "Personalized Federated Learning using Hypernetworks"

Related tags

Deep Learning pFedHN
Overview

Personalized Federated Learning using Hypernetworks

This is an official implementation of Personalized Federated Learning using Hypernetworks paper. [Link]

Installation

  • Create a virtual environment with conda/virtualenv
  • Clone the repo
  • Run: cd <PATH_TO_THE_CLONED_REPO>
  • Run: pip install -e . to install necessary packages and path links.

Reproduce Paper Results


PfedHN Results on CIFAR10
  • Run: cd experiments/pfedhn
  • Run: python trainer.py

PfedHN-PC Results on CIFAR10
  • Run: cd experiments/pfedhn_pc
  • Run: python trainer.py

Citation

If you find pFedHN to be useful in your own research, please consider citing the following paper:

@article{shamsian2021personalized,
  title={Personalized Federated Learning using Hypernetworks},
  author={Shamsian, Aviv and Navon, Aviv and Fetaya, Ethan and Chechik, Gal},
  journal={arXiv preprint arXiv:2103.04628},
  year={2021}
}
Comments
  • how to update v_i

    how to update v_i

    Dear authors,

    It is unclear to me where in your code, you update v_i as in line 11 of Algorithm 1 in your paper (Personalized Federated Learning using Hypernetworks).

    In your code (main/experiments/pfedhn/trainer.py), you compute hnet_grads (line 172 in trainer.py), which is \delta_phi \theta^T \delta \theta, used to update \phi in line 10 of Alg 1. Then you assign values of hnet_grads to update hnet weights (line 177 in trainer.py), which include v_i update. In this case, it seems to me that, you update v_i as follows:

    v_i = v_i - alpha \delta_phi \theta^T \delta \theta.

    I do not see how you have the components of \delta_vi \phi^T as in line 11 of Alg 1 in the paper.

    Could you please explain the v_i update?

    Thanks a lot!

    opened by PhungLai728 5
  • v-i update

    v-i update

    Dear authors,

    When I look closer to Alg 1 and the code, I concern about updating v_i.

    As I tested, if I use num_nodes =50, then the emb size is [50,13] and if I use num_nodes =75, then the emb size is [75,19]. It means that if at each iteration, you use one client to update the model, so only one row of the emb will be updated. I also checked the gradient, it is correct with what I understand (only 1 row of the grad has values not 0, and all other rows are 0).

    However, in the optimizer, you use SGD with momentum=0.9. In that case, it does update other rows of the emb, not only at the selected client. This is different from the update rule that you have in Alg 1. If I use SGD without momentum, it only updates 1 row as expected (as the same as Alg 1).

    Do you have any reason or insights in this case? Why you use 1 client, but update all embedding of all clients in your experiments, which is different from Alg.1?

    opened by PhungLai728 2
  • Algorithm question

    Algorithm question

    Thank you for sharing the source code, it is extremely useful and straightforward. This paper will be one of the main references for my future work.

    I have one question regarding the algorithm: is there any specific reason for choosing only one user per iteration? I guess one reason is to reduce the computational cost, I would appreciate if you could share your thoughts on my question.

    Thank you very much for your time. Please stay safe during this time!

    opened by thon94 2
  • where is the code for part of Computational Budget ?

    where is the code for part of Computational Budget ?

    In your paper 5.2 and table 2, clients with different hardware capacity can use different model architectures. I wonder how you implement it using pFedHN. Nice job, thanks!

    opened by chenslcool 2
  • The experiments about model size

    The experiments about model size

    Hi, I wanna test the results of model size under 75 nodes setting in CIFAR-100, but it

      assert (classes_per_user * num_users) % num_classes == 0, "equal classes appearance is needed"
    AssertionError: equal classes appearance is needed
    
    

    If I ignore this assert, it would appear another error:

        class_partitions['prob'].append([class_dict[i]['prob'].pop() for i in c])
    IndexError: pop from empty list
    

    Anything is okay in other node number or in CIFAR-10. Could u plz tell me how to fix it, thx a lot.

    opened by Zi-YuanYang 1
  • Generalization to Novel Clients

    Generalization to Novel Clients

    Hi,

    In Section 5.3, you mentioned the generalization to novel clients. However, I didn't find the implementation of generalization in this git repo. Could you please provide the code or details for reproducing the result in Figure 2?

    Thanks!

    opened by haolanut 1
Owner
Aviv Shamsian
Computer Vision Researcher
Aviv Shamsian
This repository contains the official implementation code of the paper Improving Multimodal Fusion with Hierarchical Mutual Information Maximization for Multimodal Sentiment Analysis, accepted at EMNLP 2021.

MultiModal-InfoMax This repository contains the official implementation code of the paper Improving Multimodal Fusion with Hierarchical Mutual Informa

Deep Cognition and Language Research (DeCLaRe) Lab 89 Dec 26, 2022
The official implementation code of "PlantStereo: A Stereo Matching Benchmark for Plant Surface Dense Reconstruction."

PlantStereo This is the official implementation code for the paper "PlantStereo: A Stereo Matching Benchmark for Plant Surface Dense Reconstruction".

Wang Qingyu 14 Nov 28, 2022
This is the official implementation code repository of Underwater Light Field Retention : Neural Rendering for Underwater Imaging (Accepted by CVPR Workshop2022 NTIRE)

Underwater Light Field Retention : Neural Rendering for Underwater Imaging (UWNR) (Accepted by CVPR Workshop2022 NTIRE) Authors: Tian Ye†, Sixiang Che

jmucsx 17 Dec 14, 2022
Reference implementation of code generation projects from Facebook AI Research. General toolkit to apply machine learning to code, from dataset creation to model training and evaluation. Comes with pretrained models.

This repository is a toolkit to do machine learning for programming languages. It implements tokenization, dataset preprocessing, model training and m

Facebook Research 408 Jan 1, 2023
Official TensorFlow code for the forthcoming paper

~ Efficient-CapsNet ~ Are you tired of over inflated and overused convolutional neural networks? You're right! It's time for CAPSULES :)

Vittorio Mazzia 203 Jan 8, 2023
Official code for Score-Based Generative Modeling through Stochastic Differential Equations

Score-Based Generative Modeling through Stochastic Differential Equations This repo contains the official implementation for the paper Score-Based Gen

Yang Song 818 Jan 6, 2023
Official code for paper "Optimization for Oriented Object Detection via Representation Invariance Loss".

Optimization for Oriented Object Detection via Representation Invariance Loss By Qi Ming, Zhiqiang Zhou, Lingjuan Miao, Xue Yang, and Yunpeng Dong. Th

ming71 56 Nov 28, 2022
This repo provides the official code for TransBTS: Multimodal Brain Tumor Segmentation Using Transformer (https://arxiv.org/pdf/2103.04430.pdf).

TransBTS: Multimodal Brain Tumor Segmentation Using Transformer This repo is the official implementation for TransBTS: Multimodal Brain Tumor Segmenta

Raymond 247 Dec 28, 2022
Official code of the paper "ReDet: A Rotation-equivariant Detector for Aerial Object Detection" (CVPR 2021)

ReDet: A Rotation-equivariant Detector for Aerial Object Detection ReDet: A Rotation-equivariant Detector for Aerial Object Detection (CVPR2021), Jiam

csuhan 334 Dec 23, 2022
Official code for the paper: Deep Graph Matching under Quadratic Constraint (CVPR 2021)

QC-DGM This is the official PyTorch implementation and models for our CVPR 2021 paper: Deep Graph Matching under Quadratic Constraint. It also contain

Quankai Gao 55 Nov 14, 2022
Official code for the ICLR 2021 paper Neural ODE Processes

Neural ODE Processes Official code for the paper Neural ODE Processes (ICLR 2021). Abstract Neural Ordinary Differential Equations (NODEs) use a neura

Cristian Bodnar 50 Oct 28, 2022
Official PyTorch Code of GrooMeD-NMS: Grouped Mathematically Differentiable NMS for Monocular 3D Object Detection (CVPR 2021)

GrooMeD-NMS: Grouped Mathematically Differentiable NMS for Monocular 3D Object Detection GrooMeD-NMS: Grouped Mathematically Differentiable NMS for Mo

Abhinav Kumar 76 Jan 2, 2023
Official code for the CVPR 2021 paper "How Well Do Self-Supervised Models Transfer?"

How Well Do Self-Supervised Models Transfer? This repository hosts the code for the experiments in the CVPR 2021 paper How Well Do Self-Supervised Mod

Linus Ericsson 157 Dec 16, 2022
Official PyTorch code of Holistic 3D Scene Understanding from a Single Image with Implicit Representation (CVPR 2021)

Implicit3DUnderstanding (Im3D) [Project Page] Holistic 3D Scene Understanding from a Single Image with Implicit Representation Cheng Zhang, Zhaopeng C

Cheng Zhang 149 Jan 8, 2023
This is the official code release for the paper Shape and Material Capture at Home

This is the official code release for the paper Shape and Material Capture at Home. The code enables you to reconstruct a 3D mesh and Cook-Torrance BRDF from one or more images captured with a flashlight or camera with flash.

null 89 Dec 10, 2022
Official code of CVPR 2021's PLOP: Learning without Forgetting for Continual Semantic Segmentation

PLOP: Learning without Forgetting for Continual Semantic Segmentation This repository contains all of our code. It is a modified version of Cermelli e

Arthur Douillard 116 Dec 14, 2022
Official code of our work, Unified Pre-training for Program Understanding and Generation [NAACL 2021].

PLBART Code pre-release of our work, Unified Pre-training for Program Understanding and Generation accepted at NAACL 2021. Note. A detailed documentat

Wasi Ahmad 138 Dec 30, 2022
official code for dynamic convolution decomposition

Revisiting Dynamic Convolution via Matrix Decomposition (ICLR 2021) A pytorch implementation of DCD. If you use this code in your research please cons

Yunsheng Li 110 Nov 23, 2022
This repo contains the official code of our work SAM-SLR which won the CVPR 2021 Challenge on Large Scale Signer Independent Isolated Sign Language Recognition.

Skeleton Aware Multi-modal Sign Language Recognition By Songyao Jiang, Bin Sun, Lichen Wang, Yue Bai, Kunpeng Li and Yun Fu. Smile Lab @ Northeastern

Isen (Songyao Jiang) 128 Dec 8, 2022