-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
SearchParameters support for IndexBinaryFlat #4055
base: main
Are you sure you want to change the base?
SearchParameters support for IndexBinaryFlat #4055
Conversation
Hi @gustavz! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
@mnorris11 whats the process of getting this PR reviewed and merged? |
@gustavz We triaged it internally (the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the pull request! It looks like the PR is missing the changes to hamming.h for the additional IDSelector argument. Could you add those, please?
2717b86
to
d70e64b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Just a few more tweaks
539dfae
to
cd8b5d3
Compare
Hi @gustavz seems like there is a small compilation error, it's asking for faiss::IDSelector instead of IDSelector? |
sorry was on vacation over the new year, pls re-review @asadoughi @mnorris11 |
Got it, will hold off on running CI until compilation error is fixed. |
@mnorris11 I dont really get this error, it does not seem to be related to my PR. Can you share a full flow of how to build and install faiss locally and how to run tests on an ARM macbook? In your comment #3865 (comment) your command It can very well be that I am missing something, but so far I wasnt able to get to running tests :/ |
Yes, mkl is an Intel library, so it won't work on ARM. Instead try those steps but with |
You can also find the dependencies that build libfaiss and faiss-cpu here: https://github.com/facebookresearch/faiss/blob/main/conda/faiss/meta.yaml You would be interested in items marked |
So I found a playbook that works to get tests running. You might want to share this with other macOS users @mnorris11 : Prepare Environment
Build faiss and run tests
|
In terms of tests, there seems to be something wrong with search result order. |
Thanks for documenting the Mac steps!
Let us know if you want assistance with the test. Feel free to attach more details. |
@mnorris11 I wasnt able to fix the tests. Out of all binary test cases only the range case passes: def test_BinaryFlat(self):
self.do_test_id_selector("BinaryFlat")
def test_BinaryFlat_id_range(self):
self.do_test_id_selector("BinaryFlat", id_selector_type="range")
def test_BinaryFlat_id_array(self):
self.do_test_id_selector("BinaryFlat", id_selector_type="array")
def test_BinaryFlat_no_heap(self):
self.do_test_id_selector("BinaryFlat", use_heap=False) To my current understanding the key issue appears to be in how the binary index handles search results with equal distances:
Is my assessment correct and do you know how to best solve this? |
@mnorris11 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
You're right that they are equal distances, printing out Dref vs Dnew is exactly the same. Since the distances are equal, either can be returned and it is still correct. There is nothing technically wrong with the results. For binary indexes in do_test_id_selector, we can just relax the id check. As long as the returned IDs are valid, and as long as the distances match, the test should pass. |
@mnorris11 great, updated tests, all pass now, gtg! |
changes were made. Clicking "dismiss" to try to bring back Import to fbsource button...
@mnorris11 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Anything to do on my side @mnorris11 ? |
Hey Gustav - can you fix the lint errors and update the branch? I'll help you merge this PR from there. |
@gtwang01 I cant see the tests |
Please provide info how I can reproduce/see the lint errors locally @gtwang01 |
I'll just provide them here: Trailing whitespace Blank line contains whitespace |
@gtwang01 I think it's good to merge now |
Context issue: #3503
We need search params support for binary flat index to be able to use it in RAG applications that support search with pre-filtering.