Closed duylncanawan closed 5 months ago
same problem here
same problem here
I found the reason, The reason is due to the lack of init_index function, you must init_index before adding_items to avoid this error. this way works for me. indexer = hnswlib.Index(space='cosine', dim=1280) indexer.init_index(max_elements = num_elements, ef_construction = 200, M = 16)
I tried using this to create a file index for my project. here is my code: import hnswlib import numpy as np
Example vectors and paths
index_data_1 = np.random.rand(1280).astype('float32') index_path_1 = '/path_1'
Add items to the index
indexer = hnswlib.Index(space='cosine', dim=1280) indexer.add_items([index_data_1, index_path_1]) indexer.save_index('example_index.idx')
but the error occurs when indexer.add_items executes.
error: segmentation fault (core dumped)
i try python gdb to run and this is my error:
so what is my problem? i use python 3.9