我有一个包含8M嵌入向量的FAISS指数。我不再有嵌入向量,只有索引,重新计算嵌入值是很昂贵的。
我能在索引中搜索与索引中的每个向量最相似的向量吗?
更确切地说,这就是我的索引是如何填充的:
d = 1024
N = 100
embeddings = np.random.rand(N, d)
ids = range(N)
index = faiss.index_factory(
d, 'IDMap,Flat', faiss.METRIC_INNER_PRODUCT
)
index.add_with_ids(embeddings, ids)我想让D, I:
D, I = index.search(embeddings, k) 但是我再也不能访问embeddings了,我只有index。
我试着用index.reconstruct()取回我的(近似的?)嵌入但我遇到
RuntimeError: Error in virtual void
faiss::Index::reconstruct(faiss::Index::idx_t, float*) const at /root/miniconda3/conda-bld/faiss-pkg_1613228717761/work/faiss/Index.cpp:57: reconstruct not implemented for this type of index发布于 2022-11-17 10:09:47
首先,似乎您在train()之前忘记了embeddings。
您的问题是什么?您可以在将embeddings添加到索引之前复制它。
https://stackoverflow.com/questions/74097858
复制相似问题