Replies: 2 comments
-
|
please don't use |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
hey there. I also tried with dynamic_cast and it is still not working. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I created a faiss index and train it as follows:
faiss::IndexHNSWFlat* generate_index(int m = 128, int ef_search = 250, int ef_construction = 64){
faiss::IndexHNSWFlat* index = new faiss::IndexHNSWFlat(512, m, faiss::METRIC_INNER_PRODUCT);
index->hnsw.efSearch = ef_search;
index->hnsw.efConstruction = ef_construction;
}
faiss::write_index(index, faiss_index_path.c_str());
std::cout<<"SAVED INDEX TO "<<faiss_index_path<<std::endl;
Now when I try to load the index and use it as
faiss::IndexHNSWFlat* index;
faiss::Index *loaded = faiss::read_index(faiss_index_path.c_str());
index = static_castfaiss::IndexHNSWFlat*(loaded);
std::vector embed_vec(embed.begin(), embed.end());
std::vector labels(5);
std::vector distances(5);
index->search(1, embed_vec.data(), 5, distances.data(), labels.data());
where embed_vec is a 512 dimensional embedding, i get the following output
pure virtual method called
terminate called without an active exception
Aborted (core dumped)
Installed from: built from source.
Faiss compilation options:using mkl
Running on:
Interface:
Beta Was this translation helpful? Give feedback.
All reactions