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

Support for embedding models (BGE, GTE etc) #22

Open
michaeljelly opened this issue Nov 27, 2023 · 9 comments · May be fixed by #86
Open

Support for embedding models (BGE, GTE etc) #22

michaeljelly opened this issue Nov 27, 2023 · 9 comments · May be fixed by #86
Labels
good first issue Good for newcomers

Comments

@michaeljelly
Copy link

Embeddings models are very useful, and can easily be run on device in terms of hardware specs.

It would be awesome if swift-transformers would work with them.

@pcuenca
Copy link
Member

pcuenca commented Nov 30, 2023

Hi @michaeljelly, thanks a lot for the great suggestion! We are currently focused on making LLMs work better and faster, and I haven't really put much thought on what expanding to embedding models would entail. It could potentially be an awesome contribution from the community! Maybe @xenova and @Vaibhavs10 have more insight on what the effort could look like.

@xenova
Copy link

xenova commented Nov 30, 2023

I actually think that embedding models are some of the easiest to add support for. 😅 Once you have BERT models supported, you automatically are able to run most of the models on the MTEB leaderboard. I see the repo already supports the BERT tokenizer, so the only additional step is to add a pooling method (typically mean or CLS pooling) to get sentence embeddings (as opposed to per-token embeddings).

Multimodal embedding models, like CLIP, can come at a later stage :)

@Vaibhavs10
Copy link
Member

IMO, it is okay to open it to the community! I think in terms of overall impact, focusing on LLMs makes more sense since, from an On-device perspective, they'd be used way more used than an embedding model.

I believe, most of the embedding models run quite competitively on CPU already.

@pcuenca pcuenca added the good first issue Good for newcomers label Nov 30, 2023
@pcuenca
Copy link
Member

pcuenca commented Nov 30, 2023

Thanks a lot @xenova and @Vaibhavs10 for your comments!

I assigned the good first issue label just to increase visibility, but it doesn't mean this will be a straightforward PR 😅 Would you be interested in drafting a PR @michaeljelly, if you have the time? We can guide you along the process and help where needed 😄

@Lurrobert
Copy link

any updates on this one?
@pcuenca, @michaeljelly

@pannous
Copy link

pannous commented Mar 7, 2024

most of the embedding models run quite competitively on CPU already

sorry if I can't find this: is there anything like huggingface swift-embedders ?

@pcuenca
Copy link
Member

pcuenca commented Mar 8, 2024

Hi @pannous! Unfortunately, there's not. This is a very interesting issue that remains open for the community to explore :)

@pannous
Copy link

pannous commented Mar 8, 2024

While not huggingface, I found this for embeddings in swift: https://github.com/ZachNagengast/similarity-search-kit
Maybe it's useful for others too and parts can be copied to huggingface? (license compatible?)

@pcuenca
Copy link
Member

pcuenca commented Mar 8, 2024

cc @ZachNagengast in case he has any feedback on his experience :)

@shavit shavit linked a pull request Mar 30, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants