-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
load file returns 0 #71
Comments
Yes seems like this |
Thanks for your reply.
|
hm get_item_vector shouldn't return 0... that's weird |
it indeed is! even i.get_nns_by_item(18, 10) works |
That's strange. Let me add a unit test and try to repro |
I won't have time today unfortunately |
@zhdeath can you post a snippet of code of how you're generating your annoy index, and how you're loading and using it? the return value of load() isn't really of much consequence is it? I think it got changed to return 0 instead of true inadvertently to be more similar to POSIX return values, but it should still work. |
Not able to reproduce...see #72 |
@a1k0n Worked on these trivial code with 1.2.2 or 1.3.1 from annoy import AnnoyIndex
import random
f = 30
a = AnnoyIndex(f) # length of item vector
n = 1000 # number of vector
for i in xrange(n):
v = []
for z in xrange(f):
v.append(random.gauss(0, 1))
a.add_item(i, v)
a.build(-1)
a.save('test.tree')
b = AnnoyIndex(f)
b.load('test.tree')
print(i.get_item_vector(10))
print(b.get_nns_by_item(10, 10)) load() returns false, get_item_vector returns [0,0...]; but get_nss_by_item(10,10) works fun. Python is 2.7.6 I think it's version related. |
Hm it seems like the issue is some kind of integer casting. The item vector looks like this for me: |
I pushed a breaking test to #72 Will now fix it |
I ran annoy 1.2.2 on Amazon EC2 with ubuntu linux 14.04, the file loading always return 0, any idea why? I would really appreciate your ideas.
PS: the file is small enough, several Kbs
The text was updated successfully, but these errors were encountered: