未验证 提交 b457c393 编写于 作者: T Tingquan Gao 提交者: GitHub

fix: dbg (#1993)

1. config["Metric"]["Train"] may be None
2. fliter -> list
上级 b838c154
...@@ -153,7 +153,7 @@ class Engine(object): ...@@ -153,7 +153,7 @@ class Engine(object):
# build metric # build metric
if self.mode == 'train' and "Metric" in self.config and "Train" in self.config[ if self.mode == 'train' and "Metric" in self.config and "Train" in self.config[
"Metric"]: "Metric"] and self.config["Metric"]["Train"]:
metric_config = self.config["Metric"]["Train"] metric_config = self.config["Metric"]["Train"]
if hasattr(self.train_dataloader, "collate_fn" if hasattr(self.train_dataloader, "collate_fn"
) and self.train_dataloader.collate_fn is not None: ) and self.train_dataloader.collate_fn is not None:
......
...@@ -61,7 +61,7 @@ class TopkAcc(AvgMetrics): ...@@ -61,7 +61,7 @@ class TopkAcc(AvgMetrics):
self.avg_meters[f"top{k}"].update(metric_dict[f"top{k}"], self.avg_meters[f"top{k}"].update(metric_dict[f"top{k}"],
x.shape[0]) x.shape[0])
self.topk = filter(lambda k: k <= output_dims, self.topk) self.topk = list(filter(lambda k: k <= output_dims, self.topk))
return metric_dict return metric_dict
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册