Skip to content

Conversation

@Guitaricet
Copy link
Contributor

Fixes #2350

In some cases, Faiss GPU index objects do not have neither "device" nor "getDevice". Possibly this happens when some part of the index is computed on CPU.

In particular, this would happen with the index OPQ16_128,IVF512,PQ32 (issue #2350). I did check it, but it is likely that OPQ or PQ transforms cause it.

I propose, instead of using the index object to get the device, to infer it form the FaissIndex.device field as it is done in .add_vectors. Here we assume that .device always corresponds to the index placement and it seems reasonable.

Copy link
Member

@lhoestq lhoestq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks ! It's definitely better this way

@lhoestq lhoestq merged commit 296e91f into huggingface:master May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FaissIndex.save throws error on GPU

2 participants