-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bfloat16 (bf16) support in faiss #3862
Comments
Note that we cannot pass through the numpy wrapper because numpy does not support bf16. Line 497 in dc55e11
|
https://github.com/facebookresearch/faiss/blob/main/faiss/gpu/GpuDistance.h#L76 |
Example of how we currently would use a PQ codec to encode/decode pytorch bf16 tensors:
this piece of code showcases all the cpu moves + up casting + converting to numpy array. Successively, at decoding, we need to convert back to a tensor. Ideally, we could avoid some of these if this was supported for pytorch tensors. |
just in case, there is a ScalarQuantizer implementation for bf16, maybe portions of it can be reused |
Many LLMs are trained with bf16, if we want to use the hidden states of LLMs for retrieval, those vectors will be in bf16 dtype. It would be helpful to support bf16 in Faiss so that we can use LLMs as retriever or embedding model.
The text was updated successfully, but these errors were encountered: