Ashx098/Embedding-Gemma_Onnx-for-vespa
By Ashx098 · ↓ 0 · ♥ 0 · Updated 2026-03-16
What's in this repo
This page lists the files in Ashx098/Embedding-Gemma_Onnx-for-vespa, including model_merged.onnx.
- 1 ONNX models (.onnx files)
- 5 files, including 1 .md, 1 .onnx, 1 .json, 1 .model
- Last updated 2026-03-16
ONNX files
| File | Size | Download |
|---|---|---|
| model_merged.onnx | — | Download |
How to use
These ONNX files can be loaded with ONNX Runtime. To inspect a model graph, upload the file to the Netron viewer. Download links point to the original files on Hugging Face.
README
Embedding Gemma ONNX for Vespa
This is a Gemma-based embedding model converted to ONNX format, optimized for use with Vespa database.
Why Single ONNX File?
Vespa database expects a single ONNX model file for embeddings. Typically, ONNX models are exported with separate files:
model.onnx- the model structureonnx_data/- weight files
This model has been merged into a single ONNX file (model_merged.onnx) so it works directly with Vespa without needing to handle external weight files.
Model Details
| Property | Value |
|---|---|
| Architecture | Gemma-based embedding model |
| Embedding Dimension | 768 |
| Input | Token IDs (int64) + Attention Mask |
| Output | Sentence embeddings (768-dim, pooled) |
Files
| File | Description |
|---|---|
model_merged.onnx |
Merged ONNX model (single file) |
tokenizer.model |
SentencePiece tokenizer |
tokenizer.json |
Tokenizer configuration |
Usage with ONNX Runtime
import onnxruntime as ort
import sentencepiece as spm
import numpy as np
# Load ONNX model
session = ort.InferenceSession('model_merged.onnx')
# Load tokenizer
sp = spm.SentencePieceProcessor()
sp.load('tokenizer.model')
# Generate embedding
text = 'Your search query'
input_ids = sp.encode(text)
attention_mask = [1] * len(input_ids)
outputs = session.run(None, {
'input_ids': np.array([input_ids], dtype=np.int64),
'attention_mask': np.array([attention_mask], dtype=np.int64)
})
embedding = outputs[1][0] # sentence_embedding output
print(embedding.shape) # (768,)
Requirements
- onnx
- onnxruntime
- sentencepiece
- numpy
Files (5)
Related models
More from Ashx098
More models
No task type declared.