From 400ca4157f86f8ca73991164e28e3f93b77cbe84 Mon Sep 17 00:00:00 2001 From: divyegala Date: Wed, 8 Nov 2023 10:43:58 -0800 Subject: [PATCH 1/5] continue on bad config --- .../raft-ann-bench/src/raft-ann-bench/run/__main__.py | 10 +++++++++- 1 file changed, 9 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 6b01263c27..38f23ddbcd 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 @@ -21,6 +21,7 @@ import uuid from importlib import import_module +import warnings import yaml @@ -368,7 +369,14 @@ def main(): algos_conf = dict() for algo_f in algos_conf_fs: with open(algo_f, "r") as f: - algo = yaml.safe_load(f) + try: + algo = yaml.safe_load(f) + except Exception as e: + warnings.warn( + f"Could not load YAML config {algo_f} due to " + + e.with_traceback() + ) + continue insert_algo = True insert_algo_group = False if filter_algos: From 934b8bb57835549c16b79e1cfb75c6bcf1946e70 Mon Sep 17 00:00:00 2001 From: divyegala Date: Wed, 8 Nov 2023 11:22:57 -0800 Subject: [PATCH 2/5] add default help --- .../src/raft-ann-bench/data_export/__main__.py | 4 ++++ .../src/raft-ann-bench/generate_groundtruth/__main__.py | 4 ++++ .../src/raft-ann-bench/get_dataset/__main__.py | 5 +++++ python/raft-ann-bench/src/raft-ann-bench/plot/__main__.py | 4 ++++ python/raft-ann-bench/src/raft-ann-bench/run/__main__.py | 4 ++++ .../src/raft-ann-bench/split_groundtruth/__main__.py | 5 +++++ 6 files changed, 26 insertions(+) diff --git a/python/raft-ann-bench/src/raft-ann-bench/data_export/__main__.py b/python/raft-ann-bench/src/raft-ann-bench/data_export/__main__.py index e19ada2934..911b0c0ea2 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/data_export/__main__.py +++ b/python/raft-ann-bench/src/raft-ann-bench/data_export/__main__.py @@ -18,6 +18,7 @@ import json import os import warnings +import sys import pandas as pd @@ -147,6 +148,9 @@ def main(): default=default_dataset_path, ) + if len(sys.argv)==1: + parser.print_help(sys.stderr) + sys.exit(1) args = parser.parse_args() convert_json_to_csv_build(args.dataset, args.dataset_path) diff --git a/python/raft-ann-bench/src/raft-ann-bench/generate_groundtruth/__main__.py b/python/raft-ann-bench/src/raft-ann-bench/generate_groundtruth/__main__.py index 77a930f81e..91f8cf04ce 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/generate_groundtruth/__main__.py +++ b/python/raft-ann-bench/src/raft-ann-bench/generate_groundtruth/__main__.py @@ -16,6 +16,7 @@ # import argparse import os +import sys import cupy as cp import numpy as np @@ -178,6 +179,9 @@ def main(): " commonly used with RAFT ANN are 'sqeuclidean' and 'inner_product'", ) + if len(sys.argv)==1: + parser.print_help(sys.stderr) + sys.exit(1) args = parser.parse_args() if args.rows is not None: diff --git a/python/raft-ann-bench/src/raft-ann-bench/get_dataset/__main__.py b/python/raft-ann-bench/src/raft-ann-bench/get_dataset/__main__.py index 4e6a0119b4..c16881bfb1 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/get_dataset/__main__.py +++ b/python/raft-ann-bench/src/raft-ann-bench/get_dataset/__main__.py @@ -16,6 +16,7 @@ import argparse import os import subprocess +import sys from urllib.request import urlretrieve @@ -101,6 +102,10 @@ def main(): help="normalize cosine distance to inner product", action="store_true", ) + + if len(sys.argv)==1: + parser.print_help(sys.stderr) + sys.exit(1) args = parser.parse_args() download(args.dataset, args.normalize, args.dataset_path) diff --git a/python/raft-ann-bench/src/raft-ann-bench/plot/__main__.py b/python/raft-ann-bench/src/raft-ann-bench/plot/__main__.py index 78f8aea8b8..30be3682cc 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/plot/__main__.py +++ b/python/raft-ann-bench/src/raft-ann-bench/plot/__main__.py @@ -22,6 +22,7 @@ import argparse import itertools import os +import sys from collections import OrderedDict import matplotlib as mpl @@ -486,6 +487,9 @@ def main(): action="store_true", ) + if len(sys.argv)==1: + parser.print_help(sys.stderr) + sys.exit(1) args = parser.parse_args() if args.algorithms: 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 38f23ddbcd..3bdb6fd42d 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 @@ -21,6 +21,7 @@ import uuid from importlib import import_module +import sys import warnings import yaml @@ -293,6 +294,9 @@ def main(): action="store_true", ) + if len(sys.argv)==1: + parser.print_help(sys.stderr) + sys.exit(1) args = parser.parse_args() # If both build and search are not provided, 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 b886d40ea7..9efac1225c 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 @@ -16,6 +16,7 @@ import argparse import os import subprocess +import sys def split_groundtruth(groundtruth_filepath): @@ -43,6 +44,10 @@ def main(): help="Path to billion-scale dataset groundtruth file", required=True, ) + + if len(sys.argv)==1: + parser.print_help(sys.stderr) + sys.exit(1) args = parser.parse_args() split_groundtruth(args.groundtruth) From 34d505fc12b8e03ce9b689a039ccf58737c7edda Mon Sep 17 00:00:00 2001 From: divyegala Date: Wed, 8 Nov 2023 11:23:44 -0800 Subject: [PATCH 3/5] style fix --- python/raft-ann-bench/src/raft-ann-bench/run/__main__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 3bdb6fd42d..34e02bd740 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 @@ -377,8 +377,8 @@ def main(): algo = yaml.safe_load(f) except Exception as e: warnings.warn( - f"Could not load YAML config {algo_f} due to " + - e.with_traceback() + f"Could not load YAML config {algo_f} due to " + + e.with_traceback() ) continue insert_algo = True From c1b8e7d8b3ee2f363c32f8344949980efdfbc045 Mon Sep 17 00:00:00 2001 From: divyegala Date: Wed, 8 Nov 2023 11:29:28 -0800 Subject: [PATCH 4/5] style fixes --- .../src/raft-ann-bench/data_export/__main__.py | 4 ++-- .../src/raft-ann-bench/generate_groundtruth/__main__.py | 2 +- .../src/raft-ann-bench/get_dataset/__main__.py | 2 +- python/raft-ann-bench/src/raft-ann-bench/plot/__main__.py | 2 +- python/raft-ann-bench/src/raft-ann-bench/run/__main__.py | 6 +++--- .../src/raft-ann-bench/split_groundtruth/__main__.py | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/python/raft-ann-bench/src/raft-ann-bench/data_export/__main__.py b/python/raft-ann-bench/src/raft-ann-bench/data_export/__main__.py index 911b0c0ea2..0241106a5b 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/data_export/__main__.py +++ b/python/raft-ann-bench/src/raft-ann-bench/data_export/__main__.py @@ -17,8 +17,8 @@ import argparse import json import os -import warnings import sys +import warnings import pandas as pd @@ -148,7 +148,7 @@ def main(): default=default_dataset_path, ) - if len(sys.argv)==1: + if len(sys.argv) == 1: parser.print_help(sys.stderr) sys.exit(1) args = parser.parse_args() diff --git a/python/raft-ann-bench/src/raft-ann-bench/generate_groundtruth/__main__.py b/python/raft-ann-bench/src/raft-ann-bench/generate_groundtruth/__main__.py index 91f8cf04ce..2423da9ed9 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/generate_groundtruth/__main__.py +++ b/python/raft-ann-bench/src/raft-ann-bench/generate_groundtruth/__main__.py @@ -179,7 +179,7 @@ def main(): " commonly used with RAFT ANN are 'sqeuclidean' and 'inner_product'", ) - if len(sys.argv)==1: + if len(sys.argv) == 1: parser.print_help(sys.stderr) sys.exit(1) args = parser.parse_args() diff --git a/python/raft-ann-bench/src/raft-ann-bench/get_dataset/__main__.py b/python/raft-ann-bench/src/raft-ann-bench/get_dataset/__main__.py index c16881bfb1..32b2b9ff47 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/get_dataset/__main__.py +++ b/python/raft-ann-bench/src/raft-ann-bench/get_dataset/__main__.py @@ -103,7 +103,7 @@ def main(): action="store_true", ) - if len(sys.argv)==1: + if len(sys.argv) == 1: parser.print_help(sys.stderr) sys.exit(1) args = parser.parse_args() diff --git a/python/raft-ann-bench/src/raft-ann-bench/plot/__main__.py b/python/raft-ann-bench/src/raft-ann-bench/plot/__main__.py index 30be3682cc..5580561b8d 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/plot/__main__.py +++ b/python/raft-ann-bench/src/raft-ann-bench/plot/__main__.py @@ -487,7 +487,7 @@ def main(): action="store_true", ) - if len(sys.argv)==1: + if len(sys.argv) == 1: parser.print_help(sys.stderr) sys.exit(1) args = parser.parse_args() 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 34e02bd740..abb1a6736d 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 @@ -18,11 +18,11 @@ import json import os import subprocess +import sys import uuid +import warnings from importlib import import_module -import sys -import warnings import yaml @@ -294,7 +294,7 @@ def main(): action="store_true", ) - if len(sys.argv)==1: + if len(sys.argv) == 1: parser.print_help(sys.stderr) sys.exit(1) args = parser.parse_args() 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 9efac1225c..a02c989614 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 @@ -45,7 +45,7 @@ def main(): required=True, ) - if len(sys.argv)==1: + if len(sys.argv) == 1: parser.print_help(sys.stderr) sys.exit(1) args = parser.parse_args() From e06b9d0b05c2dd3357fbfc1d6edb9a70eca5b680 Mon Sep 17 00:00:00 2001 From: divyegala Date: Wed, 8 Nov 2023 11:34:13 -0800 Subject: [PATCH 5/5] print to stdout --- .../raft-ann-bench/src/raft-ann-bench/data_export/__main__.py | 2 +- .../src/raft-ann-bench/generate_groundtruth/__main__.py | 2 +- .../raft-ann-bench/src/raft-ann-bench/get_dataset/__main__.py | 2 +- python/raft-ann-bench/src/raft-ann-bench/plot/__main__.py | 2 +- python/raft-ann-bench/src/raft-ann-bench/run/__main__.py | 2 +- .../src/raft-ann-bench/split_groundtruth/__main__.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/python/raft-ann-bench/src/raft-ann-bench/data_export/__main__.py b/python/raft-ann-bench/src/raft-ann-bench/data_export/__main__.py index 0241106a5b..47da9f39fa 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/data_export/__main__.py +++ b/python/raft-ann-bench/src/raft-ann-bench/data_export/__main__.py @@ -149,7 +149,7 @@ def main(): ) if len(sys.argv) == 1: - parser.print_help(sys.stderr) + parser.print_help() sys.exit(1) args = parser.parse_args() diff --git a/python/raft-ann-bench/src/raft-ann-bench/generate_groundtruth/__main__.py b/python/raft-ann-bench/src/raft-ann-bench/generate_groundtruth/__main__.py index 2423da9ed9..f4d97edea5 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/generate_groundtruth/__main__.py +++ b/python/raft-ann-bench/src/raft-ann-bench/generate_groundtruth/__main__.py @@ -180,7 +180,7 @@ def main(): ) if len(sys.argv) == 1: - parser.print_help(sys.stderr) + parser.print_help() sys.exit(1) args = parser.parse_args() diff --git a/python/raft-ann-bench/src/raft-ann-bench/get_dataset/__main__.py b/python/raft-ann-bench/src/raft-ann-bench/get_dataset/__main__.py index 32b2b9ff47..0a6c37aabc 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/get_dataset/__main__.py +++ b/python/raft-ann-bench/src/raft-ann-bench/get_dataset/__main__.py @@ -104,7 +104,7 @@ def main(): ) if len(sys.argv) == 1: - parser.print_help(sys.stderr) + parser.print_help() sys.exit(1) args = parser.parse_args() diff --git a/python/raft-ann-bench/src/raft-ann-bench/plot/__main__.py b/python/raft-ann-bench/src/raft-ann-bench/plot/__main__.py index 5580561b8d..c45ff5b14e 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/plot/__main__.py +++ b/python/raft-ann-bench/src/raft-ann-bench/plot/__main__.py @@ -488,7 +488,7 @@ def main(): ) if len(sys.argv) == 1: - parser.print_help(sys.stderr) + parser.print_help() sys.exit(1) args = parser.parse_args() 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 abb1a6736d..c9fde6dd7e 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 @@ -295,7 +295,7 @@ def main(): ) if len(sys.argv) == 1: - parser.print_help(sys.stderr) + parser.print_help() sys.exit(1) args = parser.parse_args() 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 a02c989614..c65360ebb0 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 @@ -46,7 +46,7 @@ def main(): ) if len(sys.argv) == 1: - parser.print_help(sys.stderr) + parser.print_help() sys.exit(1) args = parser.parse_args()