Hi, I replace the model in the tutorials with deep learning models like ResNet and DenseNet, errors occur during the simulation: in _load_from_state_dict input_param = input_param[0]
IndexError: index 0 is out of bounds for dimension 0 with size 0.
I have no idea how to solve it since there’s no error when I train and test the deep learning model without federated learning.
Hello @thefool. It looks maybe like an issue with converting the model weights to NDArrays
. Can you share more details of the error and/or your code?
Thanks for the reply.
I just replace the model in the tutorial with the models pytorch have and modify them to satisfy the input and output size of CIFAR-10. For example:
net=densenet121() net.classifier = nn.Linear(1024, 10) OR
class CIFAR10ResNet(nn.Module):
def init(self):
super(CIFAR10ResNet, self).init()
self.resnet = models.resnet18(weights=None)
self.resnet.conv1 = nn.Conv2d(3, 64, kernel_size=3, stride=1, padding=1, bias=False)
self.resnet.maxpool = nn.Identity()
self.resnet.fc = nn.Linear(512, 10)
def forward(self, x):
return self.resnet(x)
I would appreciate it if anyone could replace the model in the tutorials with models like ResNet and DenseNet to see if they can work.
That’s a good suggestion. In our old examples, we used MobileNetV2
(see this for example) but no longer include that in our examples. Perhaps it’s worth doing so now.
Would you be willing to contribute an example @thefool?
But as I state in this post when I want to use deep learning models to replace the models in the flower tutorials I meet errors. Sorry I can’t contribute an example.
I added a more complete minimum reproducible example in the corresponding Github issue: State dict creation bug for e.g. resnet18 · Issue #4344 · adap/flower · GitHub
Thank you for the solution!
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.