Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Special case for loading .npy files #29

Merged
merged 1 commit into from
Feb 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions experiments/run-big-bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,6 @@
}


def load_sift_dataset(
train_dataset_path: str, queries_path: str, gtruth_path: str
) -> Tuple[np.ndarray]:
return (
np.load(train_dataset_path).astype(np.float32),
np.load(queries_path).astype(np.float32),
np.load(gtruth_path).astype(np.uint32),
)


def load_benchmark_dataset(
train_dataset_path: str,
queries_path: str,
Expand Down Expand Up @@ -81,6 +71,17 @@ def load_ground_truth(path: str) -> Tuple[np.ndarray, np.ndarray, int, int]:

verify_paths_exist([train_dataset_path, queries_path, gtruth_path])

files_have_npy_extensions = all(
dataset.endswith("npy")
for dataset in [train_dataset_path, queries_path, gtruth_path]
)
if files_have_npy_extensions:
return (
np.load(train_dataset_path).astype(np.float32, copy=False),
np.load(queries_path, np.float32, copy=False),
np.load(gtruth_path, np.uint32, copy=False),
)

train_dtype = np.float32 if train_dataset_path.endswith("fbin") else np.uint8
total_size = os.path.getsize(train_dataset_path) // np.dtype(train_dtype).itemsize

Expand Down
Loading