faiss icon indicating copy to clipboard operation
faiss copied to clipboard

try to use pytorch dataloader to load indexFlatL2 through multiprocessing but get pickle error

Open sophiezhai opened this issue 6 years ago • 2 comments

Summary

Hi, I try to use pytorch dataloader to load GPU indexFlatL2 through multiprocessing but get pickle error, is there a way to solve it so that I can load the data faster? I change the collate file so that it could load index when num_workder=0, but when I try to increase the num_worker, it failed, I paste the error below, any advice will be very helpful!

Platform

python3.7, cuda10.2, GPU V100 OS: Ubuntu 18.04

Faiss version: faiss---1.6.3

Faiss compilation options:

Running on:

  • [ ] CPU
  • [.] GPU

Interface:

  • [ ] C++
  • [.] Python

Reproduction instructions

Traceback (most recent call last): File "/usr/lib/python3.7/multiprocessing/queues.py", line 236, in _feed obj = _ForkingPickler.dumps(obj) File "/usr/lib/python3.7/multiprocessing/reduction.py", line 51, in dumps cls(buf, protocol).dump(obj)

sophiezhai avatar Jul 27 '20 03:07 sophiezhai

Pickling Faiss indexes is not supported currently (even less for GPU indexes). However, since you are using a flat index, you can just transfer the index content and not build the index at all, see https://github.com/facebookresearch/faiss/wiki/Brute-force-search-without-an-index

mdouze avatar Jul 27 '20 09:07 mdouze

no acitivity, closing.

mdouze avatar Aug 25 '20 13:08 mdouze