Closed jxthyatt closed 10 months ago
I notice that do_norm() is new function in datasets.py, which is different from FedEM code.
Hi, this is because we were evaluating our model on altering P(x) and P(y|x) (which is not included in the FedEM's code), it seems some part of the code is not updated correctly. Can I get back to you sometime next week? I am currently occupied.
Looking forward to it! Also, I have a new question: how to get "data/cifar10/all_data/PCA.pkl"?
Sorry for the late reply, I will upload them this week. Essentially these PCA files are extracted after perturbing P(X) and P(Y|X).
Hi, it seems it is not necessary to have the normalization layer. You can probably just comment it out, if the problem persists, please let me know! It may be due to the dimension manipulation. For the PCA, you can actually get these PCA.pkl files by uncommenting 42-72 lines to create these projections.
I will update the descriptions and code shortly after.
Run FedEM ==> Clients initialization.. ===> Building data iterators.. Traceback (most recent call last): File "run_experiment.py", line 244, in
run_experiment(args)
File "run_experiment.py", line 142, in run_experiment
clients = initclients(args,
File "run_experiment.py", line 31, in init_clients
get_loaders(
File "/mnt/traffic1/data/jxt/Personalized_Federated_Learning/FedGMM/utils/utils.py", line 375, in get_loaders
inputs, targets = get_cifar10(dist_shift, dp)
File "/mnt/traffic1/data/jxt/Personalized_Federated_Learning/FedGMM/datasets.py", line 1170, in get_cifar10
cifar10_data = d_norm(cifar10_data)
File "/mnt/traffic/home/jxt/miniconda3/envs/FedGMM/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _callimpl
result = self.forward(*input, **kwargs)
File "/mnt/traffic/home/jxt/miniconda3/envs/FedGMM/lib/python3.8/site-packages/torchvision/transforms/transforms.py", line 221, in forward
return F.normalize(tensor, self.mean, self.std, self.inplace)
File "/mnt/traffic/home/jxt/miniconda3/envs/FedGMM/lib/python3.8/site-packages/torchvision/transforms/functional.py", line 336, in normalize
tensor.sub(mean).div_(std)
RuntimeError: The size of tensor a (32) must match the size of tensor b (3) at non-singleton dimension 1
I train on cifar10 dataset and have this problem.