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

Updating a compressed index fails with AttributeError: 'NNDescent' object has no attribute '_neighbor_graph' #246

Open
lsorber opened this issue Aug 11, 2024 · 2 comments

Comments

@lsorber
Copy link

lsorber commented Aug 11, 2024

Minimal example that reproduces the problem:

import numpy as np
from pynndescent import NNDescent

X = np.random.randn(1024, 384).astype(dtype=np.float32)
ann_index = NNDescent(X, metric="cosine", compressed=True)
ann_index.prepare()

X_update = np.random.randn(1024, 384).astype(dtype=np.float32)
ann_index.update(X_update)

Results in an AttributeError: 'NNDescent' object has no attribute '_neighbor_graph'.

With compressed=False this issue doesn't occur.

Thank you for the great package 🙏!

@lmcinnes
Copy link
Owner

compressed=True indexes are, unfortunately, not updateable; a bunch of the information needed for the update is dropped to compress the whole thing down to be smaller.

@lsorber
Copy link
Author

lsorber commented Aug 12, 2024

Thanks for the clarification! Would it make sense to for instance raise a more informative error when attempting to update a compressed index to help other users know about this limitation?

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

No branches or pull requests

2 participants