Open regstuff opened 2 years ago
Hi @regstuff According to me, the following is the problem: You are doing -
with open('pynnindex','wb') as f:
pickle.dump(pynnindex,f)
Which means you are pickling the index itself.
Now when you do this:
with open('pynnindex','rb') as f:
msgembed = pickle.load(f)
You have loaded the index, which is same as the pynnindex
, so now msgembed
is index.
Finally when you do this:
pynnindex_p = pynndescent.NNDescent(msgembed)
You are trying to create an index on an index.
Instead just use the msgembed
as the index, like you can do msgembed.query(...)
and such.
Hi Using the latest version via pip install. Running this on Google Colab with python 3.7.13 Followed the Docs and created an index with the params
pynnindex = pynndescent.NNDescent(arr, metric="cosine", n_neighbors=100)
Everything works fine and I get results from pynnindex.neighbor_graph as expected.Then I pickled the index like so:
The trouble starts when I try to load the pickled index later on, like so:
I get the following error:
The error crops up even after running prepare() on the index. Tried loading the index on another system (with python 3.9.0) and got a different error:
Essentially, to use the index, I need to build it every time. Can anyone point me towards a resolution.
Thanks