Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support faiss FLAT index get vector with metric COSINE #80

Merged

Conversation

cydrain
Copy link
Collaborator

@cydrain cydrain commented Sep 13, 2023

Issue: #79

@mergify
Copy link

mergify bot commented Sep 13, 2023

@cydrain 🔍 Important: PR Classification Needed!

For efficient project management and a seamless review process, it's essential to classify your PR correctly. Here's how:

  1. If you're fixing a bug, label it as kind/bug.
  2. For small tweaks (less than 20 lines without altering any functionality), please use kind/improvement.
  3. Significant changes that don't modify existing functionalities should be tagged as kind/enhancement.
  4. Adjusting APIs or changing functionality? Go with kind/feature.

For any PR outside the kind/improvement category, ensure you link to the associated issue using the format: “issue: #”.

Thanks for your efforts and contribution to the community!.

@zhengbuqian
Copy link
Collaborator

/approve

@cydrain
Copy link
Collaborator Author

cydrain commented Sep 15, 2023

/kind enhancement

@cydrain
Copy link
Collaborator Author

cydrain commented Sep 15, 2023

/hold

Signed-off-by: Yudong Cai <yudong.cai@zilliz.com>
@cydrain cydrain force-pushed the caiyd_support_flat_cosine_get_vector branch from 13c58bc to 5401bbc Compare September 20, 2023 01:33
@mergify mergify bot added ci-passed and removed ci-passed labels Sep 20, 2023
@cydrain
Copy link
Collaborator Author

cydrain commented Sep 20, 2023

/unhold

@cydrain
Copy link
Collaborator Author

cydrain commented Sep 20, 2023

/hold

Copy link
Collaborator

@zhengbuqian zhengbuqian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

src/index/flat/flat.cc Show resolved Hide resolved
@sre-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cydrain, zhengbuqian

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [cydrain,zhengbuqian]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Collaborator

@hhy3 hhy3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@cydrain
Copy link
Collaborator Author

cydrain commented Sep 20, 2023

/unhold

@sre-ci-robot sre-ci-robot merged commit ea12387 into zilliztech:main Sep 20, 2023
7 checks passed
@cydrain cydrain deleted the caiyd_support_flat_cosine_get_vector branch September 20, 2023 10:25
index->train(rows, (const float*)data);
}
if constexpr (std::is_same<faiss::IndexIVFFlatCC, T>::value) {
const IvfFlatCcConfig& ivf_flat_cc_cfg = static_cast<const IvfFlatCcConfig&>(cfg);
auto nlist = MatchNlist(rows, ivf_flat_cc_cfg.nlist.value());
qzr = new (std::nothrow) typename QuantizerT<T>::type(dim, metric.value());
index = std::make_unique<faiss::IndexIVFFlatCC>(qzr, dim, nlist, ivf_flat_cc_cfg.ssize.value(), is_cosine,
metric.value());
index = std::make_unique<faiss::IndexIVFFlatCC>(qzr, dim, nlist, ivf_flat_cc_cfg.ssize.value(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we reverse the order?

Comment on lines +31 to +33
FAISS_THROW_IF_NOT(is_trained);
codes.resize((ntotal + n) * code_size);
sa_encode(n, x, &codes[ntotal * code_size]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't call Index::add() here and handle norm after this calling

@liliu-z
Copy link
Collaborator

liliu-z commented Oct 13, 2023

issue: milvus-io/milvus#26960

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants