首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何保存使用ScaNN构建的索引?

如何保存使用ScaNN构建的索引?
EN

Stack Overflow用户
提问于 2021-08-08 23:10:01
回答 1查看 44关注 0票数 0

我想知道如何保存使用ScaNN tool构建的索引。

代码语言:javascript
复制
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)

EN

回答 1

Stack Overflow用户

发布于 2021-08-08 23:35:36

GitHub issue.中提到了答案

下面是scann 1.2的工作语法

代码语言:javascript
复制
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)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68705354

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档