facebookresearch / faiss

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

a plugin for faiss #3874

Closed alexanderguzhva closed 1 month ago

alexanderguzhva commented 2 months ago

I'm finalizing a separate library for speeding up training of ProductQuantizer and ProductResidualQuantizer, which is written in C++ and can be easily integrated in C++ code via faiss::Index interfaces.

Does Faiss contain any examples of providing a plugin-style code for it's python wrapper, so it would be possible to inject the library into a python faiss as well? Or, maybe, to write a swig-wrapper for the library.

@mdouze

mdouze commented 2 months ago

Not sure what you need, but basically there are two approaches to this:

  1. python callbacks that allow python to be called from C++ here https://github.com/facebookresearch/faiss/blob/main/faiss/python/python_callbacks.h
  2. independent SWIG modules that provide sub-classes of existing C++ objects wrapped in python, see https://github.com/facebookresearch/faiss/wiki/Python-C---code-snippets#wrapping-small-c-objects-for-use-from-python unfortunately this second option does not always work smoothly, so there is an open diff / PR to add tests to catch regressions, see https://github.com/facebookresearch/faiss/pull/3699
github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 7 days with no activity.

github-actions[bot] commented 1 month ago

This issue was closed because it has been inactive for 7 days since being marked as stale.