diff --git a/src/smlp_py/train_keras.py b/src/smlp_py/train_keras.py index 15b66514..2c5d930f 100644 --- a/src/smlp_py/train_keras.py +++ b/src/smlp_py/train_keras.py @@ -370,7 +370,7 @@ def _log_model_summary(self, model, epochs, batch_size, sample_weights, callback for k, v in self._loss_functions.items(): if str(v) in str(model.loss) or str(k) in str(model.loss): self._keras_logger.info("Loss function: " + str(k)) - if hasattr(model, 'compiled_metrics'): + if hasattr(model, 'compiled_metrics') and hasattr(model.compiled_metrics, '_metrics'): compiled_metrics = model.compiled_metrics._metrics # Access the private _metrics attribute self._keras_logger.info("Metrics: " + str([m.name for m in compiled_metrics])) else: @@ -900,5 +900,3 @@ def keras_main(self, resp_names:list[str], algo:str, seed, weights_coef, model_per_response) self._keras_logger.info('keras_main: end') return model - - \ No newline at end of file