-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clean Cargo.toml and add CLI for stand-alone-test
Signed-off-by: whateveraname <[email protected]>
- Loading branch information
1 parent
ba858c9
commit 7e3193a
Showing
9 changed files
with
295 additions
and
166 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
use clap::{Parser, Subcommand}; | ||
use stand_alone_test::{make_hnsw, prepare_dataset, search_hnsw}; | ||
|
||
#[derive(Parser)] | ||
struct Args { | ||
#[command(subcommand)] | ||
command: Commands, | ||
} | ||
|
||
#[derive(Subcommand)] | ||
enum Commands { | ||
/// Prepare dataset for testing | ||
PrepareDataset { | ||
/// path to the data file in fvecs format | ||
#[arg(short, long)] | ||
data_file: String, | ||
|
||
/// directory to save the prepared dataset | ||
#[arg(short, long)] | ||
output_dir: String, | ||
}, | ||
|
||
/// Make HNSW index | ||
MakeHnsw { | ||
/// directory of the prepared dataset | ||
#[arg(short, long)] | ||
data_dir: String, | ||
|
||
/// dimension of the data | ||
#[arg(long)] | ||
dims: u32, | ||
|
||
/// m parameter for HNSW index | ||
#[arg(short, long)] | ||
m: u32, | ||
|
||
/// ef_construction parameter for HNSW index | ||
#[arg(short, long)] | ||
ef_construction: usize, | ||
|
||
/// directory to save the hnsw index | ||
#[arg(short, long)] | ||
output_dir: String, | ||
}, | ||
|
||
/// Search HNSW index | ||
SearchHnsw { | ||
/// directory of the prepared dataset | ||
#[arg(short, long)] | ||
data_dir: String, | ||
|
||
/// dimension of the data | ||
#[arg(long)] | ||
dims: u32, | ||
|
||
/// directory of the hnsw index | ||
#[arg(short, long)] | ||
hnsw_dir: String, | ||
|
||
/// path to the query file in fvecs format | ||
#[arg(short, long)] | ||
query_file: String, | ||
|
||
/// path to the ground truth file in ivecs format | ||
#[arg(short, long)] | ||
gt_file: String, | ||
|
||
/// ef_search parameter for HNSW search | ||
#[arg(long)] | ||
ef: usize, | ||
}, | ||
} | ||
|
||
fn main() { | ||
let args = Args::parse(); | ||
match &args.command { | ||
Commands::PrepareDataset { | ||
data_file, | ||
output_dir, | ||
} => { | ||
prepare_dataset(data_file, output_dir); | ||
} | ||
Commands::MakeHnsw { | ||
data_dir, | ||
dims, | ||
m, | ||
ef_construction, | ||
output_dir, | ||
} => { | ||
make_hnsw(data_dir, *dims, *m, *ef_construction, output_dir); | ||
} | ||
Commands::SearchHnsw { | ||
data_dir, | ||
dims, | ||
hnsw_dir, | ||
query_file, | ||
gt_file, | ||
ef, | ||
} => { | ||
search_hnsw(data_dir, *dims, hnsw_dir, query_file, gt_file, *ef); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.