Skip to content

Commit a208651

Browse files
author
Situ Singh
authored
[tutorial] Fix KeyError: 'w_old' (#1425)
Signed-off-by: Situ Singh <[email protected]>
1 parent 41f2cdc commit a208651

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

openfl-tutorials/experimental/workflow/403_Federated_FedProx_PyTorch_MNIST_Workflow_Tutorial.ipynb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,8 @@
278278
" output = self.model(data)\n",
279279
" loss = F.cross_entropy(output, target)\n",
280280
" loss.backward()\n",
281+
" \n",
282+
" self.optimizer.set_old_weights([p.clone().detach() for p in self.model.parameters()])\n",
281283
" self.optimizer.step()\n",
282284
"\n",
283285
" if (len(data) * batch_idx) / len(self.train_loader.dataset) >= log_threshold:\n",

0 commit comments

Comments
 (0)