def IndexLoad()

in src/indexing.py [0:0]


def IndexLoad(idx_path, nprobe=0, gpu=False):
    print('Reading FAISS index', file=sys.stderr)
    print(' - index: {:s}'.format(idx_path), file=sys.stderr)
    index = faiss.read_index(idx_path)
    print(' - found {:d} sentences of dim {:d}'.format(index.ntotal, index.d), file=sys.stderr)
    print(' - setting nbprobe to {:d}'.format(nprobe), file=sys.stderr)
    if gpu:
        print(' - transfer index to %d GPUs ' % faiss.get_num_gpus(), file=sys.stderr)
        index = faiss.index_cpu_to_all_gpus(index) # co=co
        faiss.GpuParameterSpace().set_index_parameter(index, 'nprobe', nprobe)
    return index