Skip to content

Commit

Permalink
Update flow.py
Browse files Browse the repository at this point in the history
Signed-off-by: Parth Mandaliya <parthx.mandaliya@intel.com>
  • Loading branch information
ParthM-GitHub committed Sep 28, 2023
1 parent 1c53e30 commit d2ad1a9
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ def inference(network, test_loader):


def fedavg(models):
models = [model.to('cpu') for model in models]
new_model = models[0]
state_dicts = [model.state_dict() for model in models]
state_dict = new_model.state_dict()
Expand Down Expand Up @@ -433,7 +432,7 @@ def join(self, inputs):
)
print(f"Average training loss = {self.average_loss}")
print(f"Average local model validation values = {self.local_model_accuracy}")
self.model = fedavg([input.model for input in inputs])
self.model = fedavg([input.model.to("cpu") for input in inputs])
self.next(self.internal_loop)

@aggregator
Expand Down

0 comments on commit d2ad1a9

Please sign in to comment.