fix train acc log

pull/1749/head
littletomatodonkey 2022-03-07 12:46:13 +08:00 committed by Tingquan Gao
parent eee3ca70fb
commit f68c098a4a
1 changed files with 3 additions and 1 deletions

View File

@ -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."