BlaiseMuhirwa / flatnav

Fast and minimal header-only graph-based index for approximate nearest neighbor search (ANNS). https://blaisemuhirwa.github.io/flatnav
Apache License 2.0
4 stars 1 forks source link

"Unsupported data type" error after load_index #73

Closed seanmacavaney closed 8 hours ago

seanmacavaney commented 10 hours ago

Thanks for the great package!

In the Python bindings, it looks like _data_type isn't being set when load_index is called. This means that invocations of cast_and_call from the search methods always fail.

Steps to reproduce:

>>> import flatnav
>>> index = flatnav.index.IndexIPFloat.load_index('/path/to/index')
>>> index.search(queries=queries, ef_search=100, K=10)
ValueError: Unsupported data type.
BlaiseMuhirwa commented 9 hours ago

Thanks for pointing this out. We will push a fix very soon!

seanmacavaney commented 9 hours ago

Awesome, thanks! I suspect the fix will involve some templating magic. But I've got a not-so-elegant temporary fix here, in case that's helpful: https://github.com/seanmacavaney/flatnav/commit/a1dd7f68b61c685069ccedf995e6ca91f30782db

BlaiseMuhirwa commented 8 hours ago

I think this is good enough for now. Do you want to submit a pull request for this? I think the longer-term solution will be to serialize one byte for the data type when we invoke index.save() so that on index loading we can infer what data type to use.

seanmacavaney commented 8 hours ago

Sure thing, on it.