Skip to content

Commit

Permalink
Update fl_model.py(Add 'validate_task', 'train_task' to __getattribut…
Browse files Browse the repository at this point in the history
…e__ of FederatedModel) (#1008)

While running the openfl-tutorials/Federated_Pytorch_MNIST_Tutorial.ipynb file, an error occurred: " AttributeError: 'FederatedModel' object has no attribute 'validate_task' ".

I modified it according to the commit contents, and the code worked well after that.

Co-authored-by: Patrick Foley <[email protected]>
  • Loading branch information
tonywjs and psfoley authored Aug 5, 2024
1 parent 6411d08 commit 1a6f87d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions openfl/federated/task/fl_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def __init__(self, build_model, optimizer=None, loss_fn=None, **kwargs):

def __getattribute__(self, attr):
"""Direct call into self.runner methods if necessary."""

if attr in [
"reset_opt_vars",
"initialize_globals",
Expand All @@ -85,6 +86,8 @@ def __getattribute__(self, attr):
"train",
"train_batches",
"validate",
"validate_task",
"train_task"
]:
return self.runner.__getattribute__(attr)
return super().__getattribute__(attr)
Expand Down

0 comments on commit 1a6f87d

Please sign in to comment.