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

Attention sparse embeddings #235

Merged
merged 9 commits into from
May 24, 2024
Merged

Attention sparse embeddings #235

merged 9 commits into from
May 24, 2024

Conversation

generall
Copy link
Member

@generall generall commented May 9, 2024

Intro new sparse model based on attention weights. Consider it as an extension of bm25 for short documents.

"History is merely a list of surprises... It can only prepare us to be surprised yet again.",
]))

for result in output:
Copy link
Member

@joein joein May 15, 2024

Choose a reason for hiding this comment

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

I bet this test could be better :D

Copy link
Member Author

Choose a reason for hiding this comment

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

I am open to suggestions

Copy link
Member

Choose a reason for hiding this comment

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

I would check some types / shapes / values (e.g. that query values are [1, 1, 1, 1]), etc.

By the way, should not we initialize it as SparseTextEmbedding(model_name="Qdrant/bm42-all-minilm-l6-v2-attentions") ?
If we want to initialize it as SparseTextEmbedding, then we also need to overload methods like query_embed in it.

Other than this, the PR looks ok

Copy link
Member Author

Choose a reason for hiding this comment

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

If we want to initialize it as SparseTextEmbedding, then we also need to overload methods like query_embed in it.

yeah, this is right

@generall generall marked this pull request as ready for review May 22, 2024 16:17
@generall generall force-pushed the attention-sparse-embeddings branch from ee7a780 to ad80e59 Compare May 22, 2024 16:18
@joein joein self-requested a review May 23, 2024 10:35
@joein joein merged commit dfd25d4 into main May 24, 2024
17 checks passed
@joein joein deleted the attention-sparse-embeddings branch May 24, 2024 13:25
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.

None yet

2 participants