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

Added API to retrieve indices from the quantization layer #41

Closed
wants to merge 1 commit into from

Conversation

RdoubleA
Copy link
Contributor

Summary:
Exposes the indices of the embedding vectors that were chosen in the quantisation layer during nearest neighbor lookup. These indices can be used in downstream tasks, such as a transformer decoder for cross-modal retrieval/generation.

Test plan:
Expanded existing unit tests in test/modules/layers/test_quantisation.py::TestQuantisation::test_quantised_output and ran pytest test/modules/layers/test_quantisation.py

@RdoubleA RdoubleA self-assigned this May 12, 2022
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 12, 2022
torchmultimodal/modules/layers/quantisation.py Outdated Show resolved Hide resolved
torchmultimodal/modules/layers/quantisation.py Outdated Show resolved Hide resolved
test/modules/layers/test_quantisation.py Outdated Show resolved Hide resolved
torchmultimodal/modules/layers/quantisation.py Outdated Show resolved Hide resolved
@RdoubleA RdoubleA force-pushed the rafiayub/get_quantised_vectors branch from f5be9f9 to c8eb2d9 Compare May 16, 2022 18:03
Copy link
Contributor

@langong347 langong347 left a comment

Choose a reason for hiding this comment

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

LGTM. Just a nit about naming in the unit test.

test/modules/layers/test_quantization.py Outdated Show resolved Hide resolved
@facebook-github-bot
Copy link
Contributor

@RdoubleA has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Summary:
Exposes the indices of the embedding vectors that were chosen in the quantisation layer during nearest neighbor lookup. These indices can be used in downstream tasks, such as a transformer decoder for cross-modal retrieval/generation.

Pull Request resolved: #41

Test Plan: Expanded existing unit tests in `test/modules/layers/test_quantisation.py::TestQuantisation::test_quantised_output` and ran `pytest test/modules/layers/test_quantisation.py`

Reviewed By: langong347

Differential Revision: D36462737

Pulled By: RdoubleA

fbshipit-source-id: dc568e9402ef471afd99207d27c679caca8b8198
@RdoubleA RdoubleA force-pushed the rafiayub/get_quantised_vectors branch from 967754d to abb1463 Compare May 17, 2022 23:20
@facebook-github-bot
Copy link
Contributor

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

@ankitade ankitade deleted the rafiayub/get_quantised_vectors branch December 7, 2022 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants