facebookresearch / faiss

A library for efficient similarity search and clustering of dense vectors.
https://faiss.ai
MIT License
30.36k stars 3.55k forks source link

TypeError: in method 'ReconstructFromNeighbors_get_neighbor_table', argument 2 of type 'faiss::ReconstructFromNeighbors::storage_idx_t' #826

Closed jasstionzyf closed 5 years ago

jasstionzyf commented 5 years ago

Summary

when i run bench_link_and_code.py, the above exception appear.

Traceback (most recent call last):
  File "bench_link_and_code.py", line 180, in <module>
    rfn, xb_full, niter=args.beta_niter)
  File "/data/scripts/imageAI/yufeiImageAI/faiss/neighbor_codec.py", line 235, in train_beta_codebook
    ngpus=0, niter=niter)
  File "/data/scripts/imageAI/yufeiImageAI/faiss/neighbor_codec.py", line 192, in neighbors_kmeans
    neighbor_table = get_neighbor_table(x_coded, Inn, pos[i])
  File "/data/scripts/imageAI/yufeiImageAI/faiss/neighbor_codec.py", line 84, in get_neighbor_table
    rfn.get_neighbor_table(i, faiss.swig_ptr(out))
  File "/data/anaconda3/lib/python3.5/site-packages/faiss/swigfaiss.py", line 3405, in get_neighbor_table
    return _swigfaiss.ReconstructFromNeighbors_get_neighbor_table(self, i, out)
TypeError: in method 'ReconstructFromNeighbors_get_neighbor_table', argument 2 of type 'faiss::ReconstructFromNeighbors::storage_idx_t'

Platform

OS: centos

Faiss version: 1.4.0

Faiss compilation options:

Running on:

Interface:

Reproduction instructions

nohup python bench_link_and_code.py \
   --db bigann100M \
   --M0 7 \
   --indexkey OPQ40_160,HNSW32_PQ40 \
   --indexfile /data_hadoop_2/mlib_data/bigann/bigann_indexfile_100M.index \
   --beta_nsq 8   \
   --beta_centroids /data_hadoop_2/mlib_data/bigann/bigann_centroids_100M.npy \
   --neigh_recons_codes /data_hadoop_2/mlib_data/bigann/bigann_neigh_recons_codes_100M.npy \
   --k_reorder 5 --efSearch 2 \
   --add_bs 10000 \
   --searchthreads 24 > ./test_100M.out &
beauby commented 5 years ago

Could you try replacing

rfn.get_neighbor_table(i, faiss.swig_ptr(out))

with

rfn.get_neighbor_table(int(i), faiss.swig_ptr(out))