feat: Add ibm-granite/granite-embedding-small-english-r2 model
Merged
AR
1mo ago+18+18+01234567890123456789-0-0-0123456789
Resolves #701
Description
Adds support for the ibm-granite/granite-embedding-small-english-r2 model using the ONNX Community exported weights. This is a highly requested, very lightweight embedding model that punches well above its weight class on the MTEB leaderboard.
All Submissions:
- Have you followed the guidelines in our Contributing document?
- Have you checked to ensure there aren't other open Pull Requests for the same update/change?
New Feature Submissions:
- Does your submission pass the existing tests?
- Have you added tests for your feature?
- Have you installed
pre-commitwithpip3 install pre-commitand set up hooks withpre-commit install?
New models submission:
- Have you added an explanation of why it's important to include this model?
- Have you added tests for the new model? Were canonical values for tests computed via the original model?
- Have you added the code snippet for how canonical values were computed?
- Have you successfully ran tests with your changes locally?
Code snippet for canonical values
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("ibm-granite/granite-embedding-small-english-r2")
embeddings = model.encode(["hello world", "flag embedding"])
print(list(embeddings[0][:5]))
# Output: [0.47021756, -0.08181943, -0.97021246, 0.10116885, -0.16487208]