Skip to content
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

QINCo implementation in CPU Faiss #3608

Closed
wants to merge 3 commits into from

Conversation

mdouze
Copy link
Contributor

@mdouze mdouze commented Jul 2, 2024

Summary:
This is a straightforward implementation of QINCo in CPU Faiss, with encoding and decoding capabilities (not training).

For this, we translate a simplified version of some torch classes:

  • tensors, restricted to 2D and int32 + float32

  • Linear and Embedding layer

Then the QINCoStep and QINCo can just be defined as C++ objects that are copy-constructable.

There is some plumbing required in the wrapping layers to support the integration. Pytroch tensors are converted to numpy for getting / setting them in C++.

Differential Revision: D59132952

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D59132952

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D59132952

mdouze added a commit to mdouze/faiss that referenced this pull request Jul 2, 2024
Summary:
Pull Request resolved: facebookresearch#3608

This is a straightforward implementation of QINCo in CPU Faiss, with encoding and decoding capabilities (not training).

For this, we translate a simplified version of some torch classes:

- tensors, restricted to 2D and int32 + float32

- Linear and Embedding layer

Then the QINCoStep and QINCo can just be defined as C++ objects that are copy-constructable.

There is some plumbing required in the wrapping layers to support the integration. Pytroch tensors are converted to numpy for getting / setting them in C++.

Differential Revision: D59132952
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D59132952

mdouze added a commit to mdouze/faiss that referenced this pull request Jul 5, 2024
Summary:
Pull Request resolved: facebookresearch#3608

This is a straightforward implementation of QINCo in CPU Faiss, with encoding and decoding capabilities (not training).

For this, we translate a simplified version of some torch classes:

- tensors, restricted to 2D and int32 + float32

- Linear and Embedding layer

Then the QINCoStep and QINCo can just be defined as C++ objects that are copy-constructable.

There is some plumbing required in the wrapping layers to support the integration. Pytroch tensors are converted to numpy for getting / setting them in C++.

Differential Revision: D59132952
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D59132952

mdouze added a commit to mdouze/faiss that referenced this pull request Jul 5, 2024
Summary:
Pull Request resolved: facebookresearch#3608

This is a straightforward implementation of QINCo in CPU Faiss, with encoding and decoding capabilities (not training).

For this, we translate a simplified version of some torch classes:

- tensors, restricted to 2D and int32 + float32

- Linear and Embedding layer

Then the QINCoStep and QINCo can just be defined as C++ objects that are copy-constructable.

There is some plumbing required in the wrapping layers to support the integration. Pytroch tensors are converted to numpy for getting / setting them in C++.

Differential Revision: D59132952
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D59132952

mdouze added a commit to mdouze/faiss that referenced this pull request Jul 5, 2024
Summary:
Pull Request resolved: facebookresearch#3608

This is a straightforward implementation of QINCo in CPU Faiss, with encoding and decoding capabilities (not training).

For this, we translate a simplified version of some torch classes:

- tensors, restricted to 2D and int32 + float32

- Linear and Embedding layer

Then the QINCoStep and QINCo can just be defined as C++ objects that are copy-constructable.

There is some plumbing required in the wrapping layers to support the integration. Pytroch tensors are converted to numpy for getting / setting them in C++.

Differential Revision: D59132952
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D59132952

mdouze added a commit to mdouze/faiss that referenced this pull request Jul 5, 2024
Summary:
Pull Request resolved: facebookresearch#3608

This is a straightforward implementation of QINCo in CPU Faiss, with encoding and decoding capabilities (not training).

For this, we translate a simplified version of some torch classes:

- tensors, restricted to 2D and int32 + float32

- Linear and Embedding layer

Then the QINCoStep and QINCo can just be defined as C++ objects that are copy-constructable.

There is some plumbing required in the wrapping layers to support the integration. Pytroch tensors are converted to numpy for getting / setting them in C++.

Differential Revision: D59132952
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D59132952

mdouze added a commit to mdouze/faiss that referenced this pull request Jul 5, 2024
Summary:
Pull Request resolved: facebookresearch#3608

This is a straightforward implementation of QINCo in CPU Faiss, with encoding and decoding capabilities (not training).

For this, we translate a simplified version of some torch classes:

- tensors, restricted to 2D and int32 + float32

- Linear and Embedding layer

Then the QINCoStep and QINCo can just be defined as C++ objects that are copy-constructable.

There is some plumbing required in the wrapping layers to support the integration. Pytroch tensors are converted to numpy for getting / setting them in C++.

Differential Revision: D59132952
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D59132952

mdouze added a commit to mdouze/faiss that referenced this pull request Jul 5, 2024
Summary:
Pull Request resolved: facebookresearch#3608

This is a straightforward implementation of QINCo in CPU Faiss, with encoding and decoding capabilities (not training).

For this, we translate a simplified version of some torch classes:

- tensors, restricted to 2D and int32 + float32

- Linear and Embedding layer

Then the QINCoStep and QINCo can just be defined as C++ objects that are copy-constructable.

There is some plumbing required in the wrapping layers to support the integration. Pytroch tensors are converted to numpy for getting / setting them in C++.

Differential Revision: D59132952
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D59132952

mdouze added a commit to mdouze/faiss that referenced this pull request Jul 5, 2024
Summary:
Pull Request resolved: facebookresearch#3608

This is a straightforward implementation of QINCo in CPU Faiss, with encoding and decoding capabilities (not training).

For this, we translate a simplified version of some torch classes:

- tensors, restricted to 2D and int32 + float32

- Linear and Embedding layer

Then the QINCoStep and QINCo can just be defined as C++ objects that are copy-constructable.

There is some plumbing required in the wrapping layers to support the integration. Pytroch tensors are converted to numpy for getting / setting them in C++.

Differential Revision: D59132952
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D59132952

mdouze added a commit to mdouze/faiss that referenced this pull request Jul 5, 2024
Summary:
Pull Request resolved: facebookresearch#3608

This is a straightforward implementation of QINCo in CPU Faiss, with encoding and decoding capabilities (not training).

For this, we translate a simplified version of some torch classes:

- tensors, restricted to 2D and int32 + float32

- Linear and Embedding layer

Then the QINCoStep and QINCo can just be defined as C++ objects that are copy-constructable.

There is some plumbing required in the wrapping layers to support the integration. Pytroch tensors are converted to numpy for getting / setting them in C++.

Differential Revision: D59132952
mdouze added a commit to mdouze/faiss that referenced this pull request Jul 8, 2024
Summary:
Pull Request resolved: facebookresearch#3608

This is a straightforward implementation of QINCo in CPU Faiss, with encoding and decoding capabilities (not training).

For this, we translate a simplified version of some torch classes:

- tensors, restricted to 2D and int32 + float32

- Linear and Embedding layer

Then the QINCoStep and QINCo can just be defined as C++ objects that are copy-constructable.

There is some plumbing required in the wrapping layers to support the integration. Pytroch tensors are converted to numpy for getting / setting them in C++.

Differential Revision: D59132952
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D59132952

mdouze added a commit to mdouze/faiss that referenced this pull request Jul 8, 2024
Summary:
Pull Request resolved: facebookresearch#3608

This is a straightforward implementation of QINCo in CPU Faiss, with encoding and decoding capabilities (not training).

For this, we translate a simplified version of some torch classes:

- tensors, restricted to 2D and int32 + float32

- Linear and Embedding layer

Then the QINCoStep and QINCo can just be defined as C++ objects that are copy-constructable.

There is some plumbing required in the wrapping layers to support the integration. Pytroch tensors are converted to numpy for getting / setting them in C++.

Differential Revision: D59132952
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D59132952

mdouze added a commit to mdouze/faiss that referenced this pull request Jul 8, 2024
Summary:
Pull Request resolved: facebookresearch#3608

This is a straightforward implementation of QINCo in CPU Faiss, with encoding and decoding capabilities (not training).

For this, we translate a simplified version of some torch classes:

- tensors, restricted to 2D and int32 + float32

- Linear and Embedding layer

Then the QINCoStep and QINCo can just be defined as C++ objects that are copy-constructable.

There is some plumbing required in the wrapping layers to support the integration. Pytroch tensors are converted to numpy for getting / setting them in C++.

Differential Revision: D59132952
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D59132952

mdouze added a commit to mdouze/faiss that referenced this pull request Jul 8, 2024
Summary:
Pull Request resolved: facebookresearch#3608

This is a straightforward implementation of QINCo in CPU Faiss, with encoding and decoding capabilities (not training).

For this, we translate a simplified version of some torch classes:

- tensors, restricted to 2D and int32 + float32

- Linear and Embedding layer

Then the QINCoStep and QINCo can just be defined as C++ objects that are copy-constructable.

There is some plumbing required in the wrapping layers to support the integration. Pytroch tensors are converted to numpy for getting / setting them in C++.

Differential Revision: D59132952
@asadoughi asadoughi self-requested a review July 8, 2024 17:55
Summary: Add dispatcher function to avoid repeating dispatching code for distance computation and result handlers.

Differential Revision: D59318865
Summary: Using the new dispatcher functions, add search func to flat codes. To test it, make IndexLattice a subclass of FlatCodes and check the resonstruction there.

Differential Revision: D59367989
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D59132952

mdouze added a commit to mdouze/faiss that referenced this pull request Jul 10, 2024
Summary:
Pull Request resolved: facebookresearch#3608

This is a straightforward implementation of QINCo in CPU Faiss, with encoding and decoding capabilities (not training).

For this, we translate a simplified version of some torch classes:

- tensors, restricted to 2D and int32 + float32

- Linear and Embedding layer

Then the QINCoStep and QINCo can just be defined as C++ objects that are copy-constructable.

There is some plumbing required in the wrapping layers to support the integration. Pytroch tensors are converted to numpy for getting / setting them in C++.

Reviewed By: asadoughi

Differential Revision: D59132952
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D59132952

mdouze added a commit to mdouze/faiss that referenced this pull request Jul 10, 2024
Summary:
Pull Request resolved: facebookresearch#3608

This is a straightforward implementation of QINCo in CPU Faiss, with encoding and decoding capabilities (not training).

For this, we translate a simplified version of some torch classes:

- tensors, restricted to 2D and int32 + float32

- Linear and Embedding layer

Then the QINCoStep and QINCo can just be defined as C++ objects that are copy-constructable.

There is some plumbing required in the wrapping layers to support the integration. Pytroch tensors are converted to numpy for getting / setting them in C++.

Reviewed By: asadoughi

Differential Revision: D59132952
Summary:
Pull Request resolved: facebookresearch#3608

This is a straightforward implementation of QINCo in CPU Faiss, with encoding and decoding capabilities (not training).

For this, we translate a simplified version of some torch classes:

- tensors, restricted to 2D and int32 + float32

- Linear and Embedding layer

Then the QINCoStep and QINCo can just be defined as C++ objects that are copy-constructable.

There is some plumbing required in the wrapping layers to support the integration. Pytroch tensors are converted to numpy for getting / setting them in C++.

Reviewed By: asadoughi

Differential Revision: D59132952
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D59132952

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in dd72e41.

abhinavdangeti pushed a commit to blevesearch/faiss that referenced this pull request Jul 12, 2024
Summary:
Pull Request resolved: facebookresearch#3608

This is a straightforward implementation of QINCo in CPU Faiss, with encoding and decoding capabilities (not training).

For this, we translate a simplified version of some torch classes:

- tensors, restricted to 2D and int32 + float32

- Linear and Embedding layer

Then the QINCoStep and QINCo can just be defined as C++ objects that are copy-constructable.

There is some plumbing required in the wrapping layers to support the integration. Pytroch tensors are converted to numpy for getting / setting them in C++.

Reviewed By: asadoughi

Differential Revision: D59132952

fbshipit-source-id: eea4856507a5b7c5f219efcf8d19fe56944df088
ketor pushed a commit to dingodb/faiss that referenced this pull request Aug 20, 2024
Summary:
Pull Request resolved: facebookresearch#3608

This is a straightforward implementation of QINCo in CPU Faiss, with encoding and decoding capabilities (not training).

For this, we translate a simplified version of some torch classes:

- tensors, restricted to 2D and int32 + float32

- Linear and Embedding layer

Then the QINCoStep and QINCo can just be defined as C++ objects that are copy-constructable.

There is some plumbing required in the wrapping layers to support the integration. Pytroch tensors are converted to numpy for getting / setting them in C++.

Reviewed By: asadoughi

Differential Revision: D59132952

fbshipit-source-id: eea4856507a5b7c5f219efcf8d19fe56944df088
aalekhpatel07 pushed a commit to aalekhpatel07/faiss that referenced this pull request Oct 17, 2024
Summary:
Pull Request resolved: facebookresearch#3608

This is a straightforward implementation of QINCo in CPU Faiss, with encoding and decoding capabilities (not training).

For this, we translate a simplified version of some torch classes:

- tensors, restricted to 2D and int32 + float32

- Linear and Embedding layer

Then the QINCoStep and QINCo can just be defined as C++ objects that are copy-constructable.

There is some plumbing required in the wrapping layers to support the integration. Pytroch tensors are converted to numpy for getting / setting them in C++.

Reviewed By: asadoughi

Differential Revision: D59132952

fbshipit-source-id: eea4856507a5b7c5f219efcf8d19fe56944df088
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants