Coder Social home page Coder Social logo

zhenqincn / fedapen Goto Github PK

View Code? Open in Web Editor NEW
10.0 10.0 3.0 37 KB

This repository contains the official implementation of the paper entitled with "FedAPEN: Personalized Cross-silo Federated Learning with Adaptability to Statistical Heterogeneity".

License: MIT License

Python 100.00%

fedapen's Introduction

Hi 👋, I'm Zhen Qin

A 3rd-Year PhD Student at College of Computer Science and Technology, Zhejiang University

zhenqincn

Languages and Tools:

python pytorch

fedapen's People

Contributors

zhenqincn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

fedapen's Issues

关于"mutual"和"heuristic_mutual"算法的问题

您好,我在尝试运行mutual算法时遇到了问题,运行命令为:
python main.py --algorithm "mutual" --dataset cifar-10 --iid 0
运行后报错:AttributeError,检查了一下代码,好像问题出在:
在recorder.py代码的第153行:

def eval(self, node):
      if self.args.algorithm in ['learned_adaptive_training', 'equal_training', 'learned_adaptive', 'mutual', 'heuristic_mutual']:
          self._eval_ensemble_model(node)
      else:
          self._eval_single_model(node)

在main.py中调用recorder.eval(node)时,mutual算法会调用self._eval_ensemble_model(node),
而在recorder.py代码的第92行:

def _eval_ensemble_model(self, node: Node):
      node.private_model = node.private_model.to(node.device)
      node.private_model.eval()
      node.shared_model = node.shared_model.to(node.device)
      node.shared_model.eval()
      
      if node.args.algorithm in ['learned_adaptive_training', 'learned_adaptive', 'equal_training']:
          weight_private = node.learned_weight_for_inference.cpu().item()
      else:
          raise AttributeError()

这里mutual算法调用了self._eval_ensemble_model(node),但却不在预设的算法类别中,因此报错AttributeError。
我的理解是原本的FML算法并没有ensemble的推断过程,所以应该让它调用self._eval_single_model(node)。我把'mutual'从recorder.py代码的第154行中移除后代码就能正确运行了。
另外,我还注意到上述地方中出现了几次'heuristic_mutual'的算法,但在trainer.py中却没有对应的算法实现,不知道是对应的算法有遗漏还是代码冗余?

models/__init__.py 中的代码似乎是冗余的

作者您好,感谢您愿意开源代码并且提供详细的运行示例,恭喜中稿KDD~

在运行您的代码时碰到了两个小小的问题:

  1. models/init.py 里的代码似乎是冗余的,不删除的话会报无法导入对应模块的错误

from .vgg import *
from .densenet import *
from .googlenet import *
from .resnet import *
from .preact_resnet import *
from .mobilenet import *
from .mobilenetv2 import *
from .efficientnet import *
from .dla import *

  1. main函数第56行导致报错:TypeError: init() got an unexpected keyword argument 'choice'
    这里我将关键字choice改为choices后问题解决(我不确定是不是我的环境版本问题所导致)
    parser.add_argument('--iid', default="0", choice=['0', '2', '4', '6', '8', 'dir0.05', 'dir0.1', 'dir0.5', 'dir1.0', 'dir5.0'], type=str, help='the type of data non-iid, number means pathological non-IID with alpha=iid / 10, note that 0 means iid (alpha=1.0), if set to "dir{iid}", meaning practical non-iid with alpha=iid')

在解决上面两个小问题后,在我的主机上就能顺利运行仓库的代码了

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.