Skip to content

Commit

Permalink
Merge pull request #2 from moverseai/callback_fix
Browse files Browse the repository at this point in the history
fix: update model.py to support callbacks for `named_components`
  • Loading branch information
tzole1155 authored Nov 19, 2024
2 parents ec3075b + 6604134 commit b56dfa3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion moai/engine/callbacks/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ def __init__(
):
super().__init__(list)
if model:
self.data.extend((c for c in model.children() if isinstance(c, Callback)))
# deprecated self.data.extend((c for c in model.children() if isinstance(c, Callback)))

if hasattr(model, "named_components"):
for component in model.named_components.values():
if isinstance(component, Callback):
self.data.append(component)
if hasattr(model, "named_monitors"):
# search within named monitors
# for callbacks
Expand Down

0 comments on commit b56dfa3

Please sign in to comment.