我想知道如何保存使用ScaNN tool构建的索引。
start = time.time()
searcher = scann.scann_ops_pybind.builder(normalized_dataset, 10, "dot_product").tree(
num_leaves=2000, num_leaves_to_search=100, training_sample_size=250000).score_ah(
2, anisotropic_quantization_threshold=0.2).reorder(100).build()
end = time.time()print(“索引延迟(ms):{:8.4f}".format( 1000*(end -start)
发布于 2021-08-08 23:35:36
此GitHub issue.中提到了答案
下面是scann 1.2的工作语法
INDEX_DIR = './index'
os.makedirs(INDEX_DIR, exist_ok=True)
searcher.serialize(INDEX_DIR) # store the scann_module
another_searcher = scann.scann_ops_pybind.load_searcher(INDEX_DIR)
neighbors, distances = another_searcher.search_batched(dataset, final_num_neighbors=25)https://stackoverflow.com/questions/68705354
复制相似问题