Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: 'tuple' object does not support item assignment #56

Open
ZhengtianZhu opened this issue Oct 12, 2022 · 2 comments
Open

TypeError: 'tuple' object does not support item assignment #56

ZhengtianZhu opened this issue Oct 12, 2022 · 2 comments

Comments

@ZhengtianZhu
Copy link

Clients in Total: 5
--- Random Initialization ---
train_accuracy: 0.00500833, 10th percentile: 0, 50th percentile: 0.00304878, 90th percentile 0.0118636
train_loss: 4.13098, 10th percentile: 4.12663, 50th percentile: 4.13026, 90th percentile 4.13544
test_accuracy: 0.0148149, 10th percentile: 0, 50th percentile: 0, 90th percentile 0.0368978
test_loss: 4.12193, 10th percentile: 4.10857, 50th percentile: 4.12467, 90th percentile 4.13296
--- Round 1 of 2000: Training 3 Clients ---
Traceback (most recent call last):
File "main.py", line 186, in
main()
File "main.py", line 83, in main

sys_metrics = server.train_model(num_epochs=args.num_epochs, batch_size=args.batch_size, minibatch=args.minibatch)

File "/hy-tmp/leaf/models/server.py", line 60, in train_model
comp, num_samples, update = c.train(num_epochs, batch_size, minibatch)
File "/hy-tmp/leaf/models/client.py", line 39, in train
comp, update = self.model.train(data, num_epochs, num_data)
File "/hy-tmp/leaf/models/model.py", line 88, in train
self.run_epoch(data, batch_size)
File "/hy-tmp/leaf/models/model.py", line 96, in run_epoch
for batched_x, batched_y in batch_data(data, batch_size, seed=self.seed):
File "/hy-tmp/leaf/models/utils/model_utils.py", line 18, in batch_data
np.random.shuffle(data_x)
File "mtrand.pyx", line 4865, in mtrand.RandomState.shuffle
File "mtrand.pyx", line 4868, in mtrand.RandomState.shuffle
TypeError: 'tuple' object does not support item assignment

my conda list:
tmpEA3E

solutions:File "/hy-tmp/leaf/models/utils/model_utils.py", line 18, in batch_data
change np.random.shuffle(data_x) ->np.random.shuffle(list(data_x))

@ZhengtianZhu
Copy link
Author

solutions:File "/hy-tmp/leaf/models/utils/model_utils.py", line 18, in batch_data
change np.random.shuffle(data_x) ->np.random.shuffle(list(data_x))
np.random.shuffle(data_y) ->np.random.shuffle(list(data_y))

@ZhengtianZhu
Copy link
Author

this platform must be based on python=3.7, otherwise, there will be some errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant