Skip to content

Commit

Permalink
Allow raft-ann-bench/run to continue after encountering bad YAML co…
Browse files Browse the repository at this point in the history
…nfigs (#1980)

Authors:
  - Divye Gala (https://github.com/divyegala)

Approvers:
  - Corey J. Nolet (https://github.com/cjnolet)

URL: #1980
  • Loading branch information
divyegala authored Nov 8, 2023
1 parent 42512f7 commit 27b23a2
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import argparse
import json
import os
import sys
import warnings

import pandas as pd
Expand Down Expand Up @@ -147,6 +148,9 @@ def main():
default=default_dataset_path,
)

if len(sys.argv) == 1:
parser.print_help()
sys.exit(1)
args = parser.parse_args()

convert_json_to_csv_build(args.dataset, args.dataset_path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#
import argparse
import os
import sys

import cupy as cp
import numpy as np
Expand Down Expand Up @@ -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.exit(1)
args = parser.parse_args()

if args.rows is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import argparse
import os
import subprocess
import sys
from urllib.request import urlretrieve


Expand Down Expand Up @@ -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.exit(1)
args = parser.parse_args()

download(args.dataset, args.normalize, args.dataset_path)
Expand Down
4 changes: 4 additions & 0 deletions python/raft-ann-bench/src/raft-ann-bench/plot/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import argparse
import itertools
import os
import sys
from collections import OrderedDict

import matplotlib as mpl
Expand Down Expand Up @@ -486,6 +487,9 @@ def main():
action="store_true",
)

if len(sys.argv) == 1:
parser.print_help()
sys.exit(1)
args = parser.parse_args()

if args.algorithms:
Expand Down
14 changes: 13 additions & 1 deletion python/raft-ann-bench/src/raft-ann-bench/run/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
import json
import os
import subprocess
import sys
import uuid
import warnings
from importlib import import_module

import yaml
Expand Down Expand Up @@ -292,6 +294,9 @@ def main():
action="store_true",
)

if len(sys.argv) == 1:
parser.print_help()
sys.exit(1)
args = parser.parse_args()

# If both build and search are not provided,
Expand Down Expand Up @@ -368,7 +373,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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import argparse
import os
import subprocess
import sys


def split_groundtruth(groundtruth_filepath):
Expand Down Expand Up @@ -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.exit(1)
args = parser.parse_args()

split_groundtruth(args.groundtruth)
Expand Down

0 comments on commit 27b23a2

Please sign in to comment.