hnswlib icon indicating copy to clipboard operation
hnswlib copied to clipboard

Is that my file.txt wrong?

Open zhengkai215 opened this issue 4 years ago • 2 comments

`import numpy as np import hnswlib

start = time() num_elements, dim = 500000, 128 INDEX = hnswlib.Index(space="cosine", dim=128) INDEX.init_index(max_elements=num_elements, ef_construction=200, M=16)

data = np.loadtxt("./item_vec.txt") item_id = data[:, 0].astype(int) item_vec = data[:, 1:] INDEX.add_items(item_vec,item_id) print("index cost time:%s" % (time() - start))`

item_vec.txt

The program always crash, and after Ctrl+Z, progress still remain, I have to kill -9 pid

zhengkai215 avatar Aug 12 '20 07:08 zhengkai215

image

also can't work on python client

zhengkai215 avatar Aug 12 '20 07:08 zhengkai215

Hi @zhengkai215, I cannot reproduce it, it finishes in 0.75 seconds. I wonder, what python version are you using? Did you install it via pip? Does it work without the ids?

yurymalkov avatar Aug 17 '20 06:08 yurymalkov