Skip to content

Conversation

danbev
Copy link
Member

@danbev danbev commented Oct 2, 2025

This commit adds support for models that use SentenceTransformer layers.

The motivation for this is that if converted model includes any of the numbered layers specified in the original models repository then these changes enable these models to be used and verified. Currently the model-conversion only support the base model output without any of the additional transformation layers.

Usage:
Convert the model that also includes the SentenceTransformer layers:

(venv) $ export EMBEDDING_MODEL_PATH="~/google/embeddinggemma-300M"
(venv) make embedding-convert-model

Verify the produced embeddings from the converted model against the original model embeddings:

(venv) make embedding-verify-logits-st

The original model can be run using SentenceTransformer:

(venv) make embedding-run-original-model-st

Run the converted model using "SentenceTransformer" layers whic enables pooling and normalization:

(venv) make embedding-run-converted-model-st

This commit adds support for models that use SentenceTransformer layers.

The motivation for this is that if converted model includes any of the
numbered layers specified in the original models repository then these
changes enable these models to be used and verified. Currently the
model-conversion only support the base model output without any of
the additional transformation layers.

Usage:
Convert the model that also includes the SentenceTransformer layers:
```console
(venv) $ export EMBEDDING_MODEL_PATH="~/google/embeddinggemma-300M"
(venv) make embedding-convert-model
```

Verify the produced embeddings from the converted model against the
original model embeddings:
```console
(venv) make embedding-verify-logits-st
```

The original model can be run using SentenceTransformer:
```console
(venv) make embedding-run-original-model-st
```

Run the converted model using "SentenceTransformer" layers whic
enables pooling and normalization:
```console
(venv) make embedding-run-converted-model-st
```
@github-actions github-actions bot added examples python python script changes labels Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
examples python python script changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant