Skip to content
2 changes: 1 addition & 1 deletion graph_net/torch/check_redundant_incrementally.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def main(args):
graph_hash = open(current_model_graph_hash_path).read()
assert (
graph_hash not in graph_hash2graph_net_model_path
), f"Redundant models detected. old-model-path:{current_model_graph_hash_path}, new-model-path:{graph_hash2graph_net_model_path[graph_hash]}."
), f"Redundant models detected. old-model-path:{graph_hash2graph_net_model_path[graph_hash]}, new-model-path:{current_model_graph_hash_path}."


if __name__ == "__main__":
Expand Down
11 changes: 10 additions & 1 deletion graph_net/torch/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ def main(args):
if not args.no_check_redundancy:
print("Check redundancy ...")
graph_net_samples_path = (
graph_net.torch.samples_util.get_default_samples_directory()
(graph_net.torch.samples_util.get_default_samples_directory())
if args.graph_net_samples_path is None
else args.graph_net_samples_path
)
cmd = f"{sys.executable} -m graph_net.torch.check_redundant_incrementally --model-path {args.model_path} --graph-net-samples-path {graph_net_samples_path}"
cmd_ret = os.system(cmd)
Expand All @@ -49,6 +51,13 @@ def main(args):
required=True,
help="Path to folder e.g '../../samples/torch/resnet18'",
)
parser.add_argument(
"--graph-net-samples-path",
type=str,
required=False,
default=None,
help="Path to GraphNet samples folder. e.g '../../samples'",
)
parser.add_argument(
"--no-check-redundancy",
action="store_true",
Expand Down
4 changes: 2 additions & 2 deletions tools/ci/check_validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function check_validation() {
fail_name=()
for model_path in ${MODIFIED_MODEL_PATHS[@]}
do
python -m graph_net.torch.validate --model-path ${GRAPH_NET_EXTRACT_WORKSPACE}/${model_path} >&2
python -m graph_net.torch.validate --model-path ${GRAPH_NET_EXTRACT_WORKSPACE}/${model_path} --graph-net-samples-path ${GRAPH_NET_EXTRACT_WORKSPACE}/samples >&2
[ $? -ne 0 ] && fail_name[${#fail_name[@]}]="${model_path}"
done
if [ ${#fail_name[@]} -ne 0 ]
Expand Down Expand Up @@ -76,4 +76,4 @@ function main() {
LOG "[INFO] check_validation run success and no error!"
}

main
main