Repository navigation
Conversation
|
FWIW, EmbeddingGemma also needs #480 for inputs over 256 tokens. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently everything is self contained in the new module
Bumblebee.SentenceTransformers.load_model(repo), but it can be exposed in Bumblebee.I had more tests that compare output with python - but it is removed in one of the commits. It can be restored or used for testing this pr.
Assisted with codex and antigravity
Summary
Adds support for SentenceTransformers models via
Bumblebee.SentenceTransformers.SentenceTransformers repositories define multi-stage inference pipelines in
modules.jsonthat stack pooling, dense projections, normalization, and custom prompt logic on top of base transformer or static embedding models. This PR adds dynamic loading and serving for these architectures while integrating natively with Bumblebee's existingNx.Servingecosystem.Key Additions
Bumblebee.SentenceTransformers:load_model/2&load_tokenizer/2: Resolves and loads the base model and stacks pipeline modules frommodules.json(with automatic fallback pooling ifmodules.jsonis missing).load_embedding_head/3: Attaches downstream SentenceTransformers layers onto an existingmodel_info.text_embedding/3: Builds anNx.Servingpipeline handling prompts (fromconfig_sentence_transformers.jsonor runtime overrides), prompt exclusion from pooling, andmax_seq_lengthtruncation.encode_queries/4&encode_corpus/4: Convenience helpers resolving default prompt aliases ("query","document", etc.).truncate_embeddings/3: Matryoshka dimension truncation with optional L2 re-normalization.Pipeline Modules Support:
mean,cls,max,weightedmean,lasttoken,mean_sqrt_len_tokens)Normalize,LayerNorm)WeightedLayerPooling&StaticEmbedding(e.g. Model2Vec)Usage