Skip to content

Commit aeba201

Browse files
committed
Optimize check_redundant_incrementally.py.
1 parent aaf986a commit aeba201

File tree

6 files changed

+12
-9
lines changed

6 files changed

+12
-9
lines changed

graph_net/paddle/check_redundant_incrementally.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,19 @@ def main(args):
6060
print(
6161
f"Totally {len(graph_hash2graph_net_model_path)} unique samples under {args.graph_net_samples_path}."
6262
)
63-
for graph_hash, graph_paths in graph_hash2graph_net_model_path.items():
64-
if len(graph_paths) > 1:
65-
print(f"Redundant models detected for grap_hash {graph_hash}:")
66-
for model_path in graph_paths:
67-
print(f" {model_path}")
68-
assert (
69-
not find_redundant
70-
), f"Redundant models detected under {args.graph_net_samples_path}."
7163

72-
if args.model_path:
64+
if not args.model_path:
65+
# Check whether there are redundant samples under samples directory.
66+
for graph_hash, graph_paths in graph_hash2graph_net_model_path.items():
67+
if len(graph_paths) > 1:
68+
print(f"Redundant models detected for grap_hash {graph_hash}:")
69+
for model_path in graph_paths:
70+
print(f" {model_path}")
71+
assert (
72+
not find_redundant
73+
), f"Redundant models detected under {args.graph_net_samples_path}."
74+
else:
75+
# Check whether the specified model is redundant.
7376
assert os.path.isdir(
7477
args.model_path
7578
), f"args.model_path {args.model_path} is not a directory!"

paddle_samples/PaddleNLP/rocketqav2-en-marco-query-encoder/graph_hash.txt renamed to paddle_samples/PaddleNLP/rocketqav2-en-marco-cross-encoder/graph_hash.txt

File renamed without changes.

paddle_samples/PaddleNLP/rocketqav2-en-marco-query-encoder/graph_net.json renamed to paddle_samples/PaddleNLP/rocketqav2-en-marco-cross-encoder/graph_net.json

File renamed without changes.

paddle_samples/PaddleNLP/rocketqav2-en-marco-query-encoder/input_meta.py renamed to paddle_samples/PaddleNLP/rocketqav2-en-marco-cross-encoder/input_meta.py

File renamed without changes.

paddle_samples/PaddleNLP/rocketqav2-en-marco-query-encoder/model.py renamed to paddle_samples/PaddleNLP/rocketqav2-en-marco-cross-encoder/model.py

File renamed without changes.

paddle_samples/PaddleNLP/rocketqav2-en-marco-query-encoder/weight_meta.py renamed to paddle_samples/PaddleNLP/rocketqav2-en-marco-cross-encoder/weight_meta.py

File renamed without changes.

0 commit comments

Comments
 (0)