From 07385dffee7074f88255f8affa6ed7a41de2f432 Mon Sep 17 00:00:00 2001 From: divyegala Date: Wed, 18 Oct 2023 14:35:08 -0700 Subject: [PATCH 1/6] fix path --- .../src/raft-ann-bench/split_groundtruth/__main__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/raft-ann-bench/src/raft-ann-bench/split_groundtruth/__main__.py b/python/raft-ann-bench/src/raft-ann-bench/split_groundtruth/__main__.py index e8625ce7d7..4592fa9ec7 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/split_groundtruth/__main__.py +++ b/python/raft-ann-bench/src/raft-ann-bench/split_groundtruth/__main__.py @@ -19,7 +19,9 @@ def split_groundtruth(groundtruth_filepath): - ann_bench_scripts_path = "split_groundtruth.pl" + ann_bench_scripts_path = \ + os.path.join(os.path.dirname(os.path.realpath(__file__)), + "split_groundtruth.pl") pwd = os.getcwd() os.chdir("/".join(groundtruth_filepath.split("/")[:-1])) groundtruth_filename = groundtruth_filepath.split("/")[-1] From db79584690d0f0da4525533e579b74b3974789be Mon Sep 17 00:00:00 2001 From: divyegala Date: Wed, 18 Oct 2023 14:38:26 -0700 Subject: [PATCH 2/6] correct dataset name --- python/raft-ann-bench/src/raft-ann-bench/run/__main__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/raft-ann-bench/src/raft-ann-bench/run/__main__.py b/python/raft-ann-bench/src/raft-ann-bench/run/__main__.py index 3b670dc464..a0d4fabb77 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/run/__main__.py +++ b/python/raft-ann-bench/src/raft-ann-bench/run/__main__.py @@ -239,7 +239,6 @@ def main(): ) conf_filename = conf_filepath.split("/")[-1] conf_filedir = "/".join(conf_filepath.split("/")[:-1]) - dataset_name = conf_filename.replace(".json", "") dataset_path = args.dataset_path if not os.path.exists(conf_filepath): raise FileNotFoundError(conf_filename) @@ -247,6 +246,8 @@ def main(): with open(conf_filepath, "r") as f: conf_file = json.load(f) + dataset_name = conf_file["dataset"]["name"] + executables_to_run = dict() # At least one named index should exist in config file if args.indices: From 5123c33a9ac7c4c56fde59961f68aca2389d7053 Mon Sep 17 00:00:00 2001 From: divyegala Date: Wed, 18 Oct 2023 14:50:36 -0700 Subject: [PATCH 3/6] fix style --- .../src/raft-ann-bench/split_groundtruth/__main__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/raft-ann-bench/src/raft-ann-bench/split_groundtruth/__main__.py b/python/raft-ann-bench/src/raft-ann-bench/split_groundtruth/__main__.py index 4592fa9ec7..e174e36390 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/split_groundtruth/__main__.py +++ b/python/raft-ann-bench/src/raft-ann-bench/split_groundtruth/__main__.py @@ -19,9 +19,9 @@ def split_groundtruth(groundtruth_filepath): - ann_bench_scripts_path = \ - os.path.join(os.path.dirname(os.path.realpath(__file__)), - "split_groundtruth.pl") + ann_bench_scripts_path = os.path.join( + os.path.dirname(os.path.realpath(__file__)), "split_groundtruth.pl" + ) pwd = os.getcwd() os.chdir("/".join(groundtruth_filepath.split("/")[:-1])) groundtruth_filename = groundtruth_filepath.split("/")[-1] From 8b21921f134f5d8c32ccc2983b8da1e59cb35254 Mon Sep 17 00:00:00 2001 From: divyegala Date: Wed, 18 Oct 2023 15:49:59 -0700 Subject: [PATCH 4/6] fix issue with local path --- .../src/raft-ann-bench/split_groundtruth/__main__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/raft-ann-bench/src/raft-ann-bench/split_groundtruth/__main__.py b/python/raft-ann-bench/src/raft-ann-bench/split_groundtruth/__main__.py index e174e36390..4e0e127db4 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/split_groundtruth/__main__.py +++ b/python/raft-ann-bench/src/raft-ann-bench/split_groundtruth/__main__.py @@ -23,7 +23,9 @@ def split_groundtruth(groundtruth_filepath): os.path.dirname(os.path.realpath(__file__)), "split_groundtruth.pl" ) pwd = os.getcwd() - os.chdir("/".join(groundtruth_filepath.split("/")[:-1])) + path_to_groundtruth = os.path.normpath(groundtruth_filepath).split(os.sep) + if len(path_to_groundtruth) > 1: + os.chdir(os.path.join(*path_to_groundtruth)) groundtruth_filename = groundtruth_filepath.split("/")[-1] subprocess.run( [ann_bench_scripts_path, groundtruth_filename, "groundtruth"], From cf8ecedb33351d6aaf4720694727ddb525773cb5 Mon Sep 17 00:00:00 2001 From: divyegala Date: Wed, 18 Oct 2023 15:51:26 -0700 Subject: [PATCH 5/6] chdir without filename --- .../src/raft-ann-bench/split_groundtruth/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/raft-ann-bench/src/raft-ann-bench/split_groundtruth/__main__.py b/python/raft-ann-bench/src/raft-ann-bench/split_groundtruth/__main__.py index 4e0e127db4..20c2841b78 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/split_groundtruth/__main__.py +++ b/python/raft-ann-bench/src/raft-ann-bench/split_groundtruth/__main__.py @@ -25,7 +25,7 @@ def split_groundtruth(groundtruth_filepath): pwd = os.getcwd() path_to_groundtruth = os.path.normpath(groundtruth_filepath).split(os.sep) if len(path_to_groundtruth) > 1: - os.chdir(os.path.join(*path_to_groundtruth)) + os.chdir(os.path.join(*path_to_groundtruth[:-1])) groundtruth_filename = groundtruth_filepath.split("/")[-1] subprocess.run( [ann_bench_scripts_path, groundtruth_filename, "groundtruth"], From d9a62e982dfea56bdf49bb59c3f4adaf3101d582 Mon Sep 17 00:00:00 2001 From: divyegala Date: Wed, 18 Oct 2023 15:52:05 -0700 Subject: [PATCH 6/6] use normpath --- .../src/raft-ann-bench/split_groundtruth/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/raft-ann-bench/src/raft-ann-bench/split_groundtruth/__main__.py b/python/raft-ann-bench/src/raft-ann-bench/split_groundtruth/__main__.py index 20c2841b78..b886d40ea7 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/split_groundtruth/__main__.py +++ b/python/raft-ann-bench/src/raft-ann-bench/split_groundtruth/__main__.py @@ -26,7 +26,7 @@ def split_groundtruth(groundtruth_filepath): path_to_groundtruth = os.path.normpath(groundtruth_filepath).split(os.sep) if len(path_to_groundtruth) > 1: os.chdir(os.path.join(*path_to_groundtruth[:-1])) - groundtruth_filename = groundtruth_filepath.split("/")[-1] + groundtruth_filename = path_to_groundtruth[-1] subprocess.run( [ann_bench_scripts_path, groundtruth_filename, "groundtruth"], check=True,