diff --git a/moai/engine/callbacks/model.py b/moai/engine/callbacks/model.py index 7e2c008..235bdb4 100644 --- a/moai/engine/callbacks/model.py +++ b/moai/engine/callbacks/model.py @@ -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