Skip to content
Snippets Groups Projects
Commit 7554b8af authored by dragondriver's avatar dragondriver Committed by yefu.chen
Browse files

Add default nbits when build ivf-pq index


Signed-off-by: default avatardragondriver <jiquan.long@zilliz.com>
parent 5a53b118
No related branches found
No related tags found
No related merge requests found
......@@ -157,6 +157,11 @@ IndexWrapper::BuildWithoutIds(const knowhere::DatasetPtr& dataset) {
auto index_type = get_index_type();
auto index_mode = get_index_mode();
config_[knowhere::meta::ROWS] = dataset->Get<int64_t>(knowhere::meta::ROWS);
if (index_type == knowhere::IndexEnum::INDEX_FAISS_IVFPQ) {
if (!config_.contains(knowhere::IndexParams::nbits)) {
config_[knowhere::IndexParams::nbits] = 8;
}
}
auto conf_adapter = knowhere::AdapterMgr::GetInstance().GetAdapter(index_type);
std::cout << "config_ when build index: " << config_ << std::endl;
AssertInfo(conf_adapter->CheckTrain(config_, index_mode), "something wrong in index parameters!");
......@@ -183,6 +188,11 @@ IndexWrapper::BuildWithIds(const knowhere::DatasetPtr& dataset) {
auto index_type = get_index_type();
auto index_mode = get_index_mode();
config_[knowhere::meta::ROWS] = dataset->Get<int64_t>(knowhere::meta::ROWS);
if (index_type == knowhere::IndexEnum::INDEX_FAISS_IVFPQ) {
if (!config_.contains(knowhere::IndexParams::nbits)) {
config_[knowhere::IndexParams::nbits] = 8;
}
}
auto conf_adapter = knowhere::AdapterMgr::GetInstance().GetAdapter(index_type);
AssertInfo(conf_adapter->CheckTrain(config_, index_mode), "something wrong in index parameters!");
// index_->Train(dataset, config_);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment