提交 4672a9e0 编写于 作者: J jinhai

Merge branch 'branch-0.3.0' into 'branch-0.3.1'

Update faiss parameter

See merge request megasearch/milvus!146

Former-commit-id: 5dca72d958dd89ace538540338dab91bf95eb2f3
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "Index.h" #include "Index.h"
#include "faiss/index_io.h" #include "faiss/index_io.h"
#include "faiss/IndexIVF.h"
namespace zilliz { namespace zilliz {
namespace milvus { namespace milvus {
...@@ -55,6 +56,9 @@ bool Index::add_with_ids(idx_t n, const float *xdata, const long *xids) { ...@@ -55,6 +56,9 @@ bool Index::add_with_ids(idx_t n, const float *xdata, const long *xids) {
bool Index::search(idx_t n, const float *data, idx_t k, float *distances, long *labels) const { bool Index::search(idx_t n, const float *data, idx_t k, float *distances, long *labels) const {
try { try {
if(auto ivf_index = std::dynamic_pointer_cast<faiss::IndexIVF>(index_)) {
ivf_index->nprobe = 100;
}
index_->search(n, data, k, distances, labels); index_->search(n, data, k, distances, labels);
} }
catch (std::exception &e) { catch (std::exception &e) {
......
...@@ -39,7 +39,7 @@ string Operand::get_index_type(const int &nb) { ...@@ -39,7 +39,7 @@ string Operand::get_index_type(const int &nb) {
} }
case IVF: { case IVF: {
index_str += (ncent != 0 ? index_type + std::to_string(ncent) : index_str += (ncent != 0 ? index_type + std::to_string(ncent) :
index_type + std::to_string(int(nb / 1000000.0 * 16384))); index_type + std::to_string(int(nb / 1000000.0 * 1638)));
break; break;
} }
case IDMAP: { case IDMAP: {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册