-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Ability to use IndexIDMap add_with_ids function with GPU based Cagra index #4107
Comments
Sample code which caused the exception
|
Hi navneet1v! The error message states that the index is not trained (
|
@pankajsingh88 actually I thought the same and tried the same thing but it didn’t work. I will put the exact trace for the same in few hours. But to ans your question I have tried it. 😄 |
@pankajsingh88 here is the updated code with the exception.
|
Looks like you don't need to add vectors explicitly in Cagra indexes. The training does that for you and you should be able to search directly. But this also implies that one doesn't have the ability to add vectors with ids. |
Absolutely correct. This is the reason why I created this issue but didn't call it as a bug :) . I am thinking of a way to go around this limitation. So what my idea here is we can support add/add_with_ids capability on the cagra index which internally calls train_index function only once. But once we have called the add api next calls to add/add_with_ids will throw the exception. This will at-least ensure that we can create an index with IndexIdMap as a wrapper. Would like to know whats your thoughts on this? @pankajsingh88 I am happy to contribute this change. |
Description
I am trying to create a GPU Cagra index in a IndexIDMap index. But facing error like this:
Based on my code reading what I can see is add_with_ids functionality is not supported with CagraIndex, but I think for the first time we should able to create the index, but subsequent adds should be blocked.
GpuIndexCagra is inherited from GpuIndex here and the exception is coming from here: and IndexIDMap uses add_with_ids
Is there any specific reason why this is blocked? If there is no specific reason I would like to contribute related to this.
Version
Faiss: 1.9.0
The text was updated successfully, but these errors were encountered: