TsingZ0 / PFLlib

37 traditional FL (tFL) or personalized FL (pFL) algorithms, 3 scenarios, and 20 datasets.
GNU General Public License v2.0
1.35k stars 283 forks source link

The incompatibility between ResNet and MNIST dataset #178

Closed yuanyangwangTJ closed 4 months ago

yuanyangwangTJ commented 5 months ago

I notice there is a command in the example.sh as following:

nohup python -u main.py -lbs 16 -nc 20 -jr 1 -nb 10 -data mnist -m resnet -algo FedAvg -gr 2000 -did 0 -go resnet > mnist_fedavg2.out 2>&1 &

However, it will give an error message while running:

untimeError: Given groups=1, weight of size [64, 3, 7, 7], expected input[16, 1, 28, 28] to have 3 channels, but got 1 channels instead

I conjecture this is because ResNet needs rgb three channels picture, so we must resolve dataset or ResNet model, I don't know whether it correct in example.sh, or what is the best way to resolve this situation (the match between model and dataset) in this framework?

Hopefully your help!

TsingZ0 commented 5 months ago

The error is a result of a mismatch between the MNIST dataset and the ResNet model.

The example.sh file is outdated and unmaintained, and has been removed. For guidance on starting the simulation, please refer to https://github.com/TsingZ0/PFLlib?tab=readme-ov-file#how-to-start-simulating-examples-for-fedavg.

Given that PFLlib encompasses various models and datasets and allows for extension with new models and datasets, it is preferable for users to determine the hyperparameter settings themselves.

zhushun05 commented 5 months ago

我注意到有一个命令如下example.sh

nohup python -u main.py -lbs 16 -nc 20 -jr 1 -nb 10 -data mnist -m resnet -algo FedAvg -gr 2000 -did 0 -go resnet > mnist_fedavg2.out 2>&1 &

但是运行时会报错:

untimeError: Given groups=1, weight of size [64, 3, 7, 7], expected input[16, 1, 28, 28] to have 3 channels, but got 1 channels instead

我猜想这是因为ResNet需要rgb三通道图片,所以我们必须解析数据集或ResNet模型,我不知道它是否正确example.sh,或者解决这种情况(模型和数据集之间的匹配)的最佳方法是什么这个框架?

希望您的帮助!

我的愚见,字符串问题, mnist应该全部大写,因为代码里也全部大写了,python区分大小写

TsingZ0 commented 5 months ago

感谢反馈!最近更新了数据集命名规范,有些其他地方还没修正。目前已经修复