SPTAG Module has no Attribute AnnIndex
Loadnf sptag indexes into the memory
index = SPTAG.AnnIndex.Load('sptag_index')
batch_size = 20
Local index test on the vector search
index = SPTAG.AnnIndex.Load('sptag_index') results = [] for val in embeddings:
result = index.SearchWithMetaData(val, batch_size) # Search k=3 nearest vectors for query vector q
results.append([str(r).replace("b\'","").replace("\\n\'","") for r in result[2]])
So, whenever we load SPTAG and calling AnnIndex attribute with it throws an error.
AttributeError Traceback (most recent call last)
AttributeError: module 'SPTAG' has no attribute 'AnnIndex'
Same to me. Very confusing. I got this error when I build index
There is no document/hint provided anywhere so that it can be fixed anyhow.
I had this issue as well. I realised that, when build the cmake module, the Release folder was being created with the SPTAG module inside. For that reason I had to do the import as:
from Release import SPTAG
This then allowed me to call the AnnIndex attribute as SPTAG.AnnIndex.Load().