GithubHelp home page GithubHelp logo

Comments (7)

Halfway-Li avatar Halfway-Li commented on July 17, 2024 1

好的,感谢大佬,最近在复现tinyimagenet在pfedla上的效果,再次感谢你的解答。

from fl-bench.

Halfway-Li avatar Halfway-Li commented on July 17, 2024

class CNNWithBatchNorm(nn.Module):
def init(self, dataset):
super(CNNWithBatchNorm, self).init()
self.block1 = nn.ModuleDict(
{
"conv": nn.Conv2d(ARGS[dataset][0], 64, 5, 1, 2),
"bn": nn.BatchNorm2d(64),
"relu": nn.ReLU(True),
"pool": nn.MaxPool2d(2),
}
)
self.block2 = nn.ModuleDict(
{
"conv": nn.Conv2d(64, 64, 5, 1, 2),
"bn": nn.BatchNorm2d(64),
"relu": nn.ReLU(True),
"pool": nn.MaxPool2d(2),
}
)
self.block3 = nn.ModuleDict(
{
"conv": nn.Conv2d(64, 128, 5, 1, 2),
"bn": nn.BatchNorm2d(128),
"relu": nn.ReLU(True),
}
)

    self.block4 = nn.ModuleDict(
        {"fc": nn.Linear(ARGS[dataset][1], 2048), "relu": nn.ReLU(True)}
    )
    self.block5 = nn.ModuleDict({"fc": nn.Linear(2048, 512), "relu": nn.ReLU(True)})
    self.block6 = nn.ModuleDict({"fc": nn.Linear(512, ARGS[dataset][2])})

def forward(self, x):
    x = self.block1["conv"](x)
    x = self.block1["bn"](x)
    x = self.block1["relu"](x)
    x = self.block1["pool"](x)

    x = self.block2["conv"](x)
    x = self.block2["bn"](x)
    x = self.block2["relu"](x)
    x = self.block2["pool"](x)

    x = self.block3["conv"](x)
    x = self.block3["bn"](x)
    x = self.block3["relu"](x)

    x = x.view(x.shape[0], -1)

    x = self.block4["fc"](x)
    x = self.block4["relu"](x)

    x = self.block5["fc"](x)
    x = self.block5["relu"](x)

    x = self.block6["fc"](x)
    return x
    
    我希望能运行上面这个模型的HpFedla

from fl-bench.

KarhouTam avatar KarhouTam commented on July 17, 2024

如果只是简单的移用,你可以把整个 CNNWithBatchNorm 的实现先拷贝到 models.py 然后在 CustomModel 中将 self.base 设置为 CNNWithBatchNorm 的一个实例,self.classifier = nn.Identity()

from fl-bench.

Halfway-Li avatar Halfway-Li commented on July 17, 2024

那Hpfedla的分层保留还会实现吗?

from fl-bench.

KarhouTam avatar KarhouTam commented on July 17, 2024

应该是会的

from fl-bench.

Halfway-Li avatar Halfway-Li commented on July 17, 2024

我在对比了pfedla和这个bench里的之后发现精度差异还是比较大的,而且bench里的pfedla似乎会出现精度越来越低的情况

from fl-bench.

KarhouTam avatar KarhouTam commented on July 17, 2024

我并不能保证bench 中的算法能够完全复现 papper 里的数据。那些没有公开源代码的尤甚。pfedla 是一个(我没记错的话)连使用的模型架构都没有公开的算法。我这能做的也只是根据paper提供的算法伪代码将其表达出来。至于最终模型的效果如何,取决于多个因素:模型架构,实验超参,随机种子...

如果给你带来困扰了的话,十分抱歉。FL-bench 并不保证搭载的算法能 100% 原汁原味复现出 paper 上的结果(对于任何其他算法都是,除了pFedSim,那是我自己写的)

而你说的精度越来越低的情况,我会在近期检查一下pfedla的代码,如果有bug我会修复。也欢迎你如果找出bug提 issue 或 pr 来为这个项目做贡献。

from fl-bench.

Related Issues (20)

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.