From f68c098a4a13ca42f364340f18dbffa12338bd2c Mon Sep 17 00:00:00 2001 From: littletomatodonkey Date: Mon, 7 Mar 2022 12:46:13 +0800 Subject: [PATCH] fix train acc log --- ppcls/engine/engine.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ppcls/engine/engine.py b/ppcls/engine/engine.py index c991b6e0..6b235998 100644 --- a/ppcls/engine/engine.py +++ b/ppcls/engine/engine.py @@ -171,7 +171,9 @@ class Engine(object): if metric_config is not None: metric_config = metric_config.get("Train") if metric_config is not None: - if hasattr(self.train_dataloader, "collate_fn"): + if hasattr( + self.train_dataloader, "collate_fn" + ) and self.train_dataloader.collate_fn is not None: for m_idx, m in enumerate(metric_config): if "TopkAcc" in m: msg = f"'TopkAcc' metric can not be used when setting 'batch_transform_ops' in config. The 'TopkAcc' metric has been removed." -- GitLab