ONNX - Google

Model FP32 Task
embeddinggemma-300m model.onnx, model.onnx_data text embedding

Usage

# onnxruntime-gpu for run it on GPU
pip install onnxruntime sentencepiece numpy

Every model folder has the same layout:

  • src/helper.py = onnx session builder (provider selection, threads, memory options)
  • src/example.py = full pipeline: sentencepiece tokenization, batching, inference, cosine similarity
  • onnx/ = the model files: xxx.onnx (structure) and xxx.onnx_data (weight), keep them in the same folder

Run the commands from the repository root.

embeddinggemma-300m

python3 embeddinggemma-300m/src/example.py
0.600231 | The giant panda (Ailuropoda melanoleuca), sometimes called a panda bear, is a bear species endemic to China.
0.153004 | hi
0.554038 | パンダはクマ科の哺乳類で、中国の固有種である。

Note:

  • No transformers/tokenizers dependency: the tokenizer is tokenizer.model directly with the native ids
    (bos_id, eos_id, pad_id from the sentencepiece model).
  • Prompt prefix per mode:
    document = title: none | text: {text}
    query = task: search result | query: {text}
  • Input format: [bos] text [eos], padded per batch to the longest sequence.
  • Output = sentence_embedding, 768 dimensions.
  • Normalize input with NFKC for consistent multilingual scores.
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support