Federated-Learning-PyTorch
Federated-Learning-PyTorch copied to clipboard
Regarding attribute errors during the federated learning both in equal and unequal cases
While running the code, the following attribute errors were coming. Can anyone tell the reasons for such errors?? For equal case:
Traceback (most recent call last):
File "src/federated_main.py", line 36, in <module>
train_dataset, test_dataset, user_groups = get_dataset(args)
File "C:\Users\sharm\Downloads\Federated-Learning-PyTorch-master\src\utils.py", line 41, in get_dataset
user_groups = cifar_noniid(train_dataset, args.num_users)
File "C:\Users\sharm\Downloads\Federated-Learning-PyTorch-master\src\sampling.py", line 173, in cifar_noniid
labels = np.array(dataset.train_labels)
File "C:\Users\sharm\.conda\envs\newEnv\lib\site-packages\torch\utils\data\dataset.py", line 83, in __getattr__
raise AttributeError
AttributeError
For Unequal case:
Traceback (most recent call last):
File "src/federated_main.py", line 36, in <module>
train_dataset, test_dataset, user_groups = get_dataset(args)
File "C:\Users\sharm\Downloads\Federated-Learning-PyTorch-master\src\utils.py", line 38, in get_dataset
raise NotImplementedError()
NotImplementedError
The CIFAR-10 dataset does not have an attribute train_labels. NotImplementedError is coded to be raised for parts that are not yet implemented.
The latest CIFAR-10 dataset calls it's labels "targets". So replace line 173 to.
labels = np.array(dataset.targets)