Skip to content

Commit f159a3d

Browse files
committed
Support to rerun the failed cases only.
1 parent d10dcc3 commit f159a3d

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

graph_net/torch/collect_stats.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,9 +397,21 @@ def main(args):
397397
if args.graph_net_samples_path is None
398398
else args.graph_net_samples_path
399399
)
400+
401+
previous_failed_model_pathes = []
402+
if args.previous_collect_result_path is not None:
403+
with open(args.previous_collect_result_path, "r") as f:
404+
for line in f.readlines():
405+
if "[ModelStats]" in line:
406+
fields = line.strip().split()
407+
model_path = fields[2].split(":")[-1]
408+
is_complete = fields[-1].split(":")[-1]
409+
if is_complete == "False":
410+
previous_failed_model_pathes.append(model_path)
411+
400412
i = 0
401413
for root, dirs, files in os.walk(graph_net_samples_path):
402-
if is_single_model_dir(root):
414+
if is_single_model_dir(root) and root in previous_failed_model_pathes:
403415
print(f"[{i}] Collect information for {root}")
404416
cmd = [
405417
"python",
@@ -447,6 +459,13 @@ def main(args):
447459
default=None,
448460
help="GraphNet samples directory. e.g '../../samples'",
449461
)
462+
parser.add_argument(
463+
"--previous-collect-result-path",
464+
type=str,
465+
required=False,
466+
default=None,
467+
help="Previous collect result path, use to recollect the failed cases",
468+
)
450469
parser.add_argument(
451470
"--log-prompt",
452471
type=str,
@@ -455,4 +474,5 @@ def main(args):
455474
help="Log prompt for stats log filtering.",
456475
)
457476
args = parser.parse_args()
477+
print(f"[CollectStats Arguments] {args}")
458478
main(args=args)

0 commit comments

Comments
 (0)