MCPcopy Create free account
hub / github.com/LUMIA-Group/MemoryDecoder / main

Function main

knn_utils/build_index.py:204–258  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

202 return index_name
203
204def main():
205 parser = argparse.ArgumentParser(description="Build a FAISS index from an Arrow datastore")
206
207 # Only required parameter is the dstore_path
208 parser.add_argument(
209 "--dstore_path",
210 type=str,
211 required=True,
212 help="Path to the Arrow file containing the datastore"
213 )
214
215 # Optional parameters
216 parser.add_argument(
217 "--num_keys_to_add_at_a_time",
218 type=int,
219 default=1_000_000,
220 help="Number of keys to add at a time"
221 )
222 parser.add_argument(
223 "--ncentroids",
224 type=int,
225 default=4096,
226 help="Number of centroids for IVFPQ"
227 )
228 parser.add_argument(
229 "--seed",
230 type=int,
231 default=42,
232 help="Random seed"
233 )
234 parser.add_argument(
235 "--code_size",
236 type=int,
237 default=32,
238 help="Code size for PQ"
239 )
240 parser.add_argument(
241 "--probe",
242 type=int,
243 default=8,
244 help="Number of probes for query"
245 )
246
247 args = parser.parse_args()
248
249 index_path = build_index(
250 dstore_path=args.dstore_path,
251 num_keys_to_add_at_a_time=args.num_keys_to_add_at_a_time,
252 ncentroids=args.ncentroids,
253 seed=args.seed,
254 code_size=args.code_size,
255 probe=args.probe
256 )
257
258 logger.info(f"Index saved to: {index_path}")
259
260if __name__ == "__main__":
261 main()

Callers 1

build_index.pyFile · 0.70

Calls 1

build_indexFunction · 0.85

Tested by

no test coverage detected