- Text sequences for embedding. The CLI uses a single query plus one or more documents via
--documentsor falls back to the built-in examples. - Token shape: (batch, sequence_length)
sentence_embeddingshape: (batch, 768)- Console shows cosine-similarity ranking between the query and provided documents.
This model requires additional module.
pip3 install transformers
Automatically downloads the onnx and prototxt files on the first run. It is necessary to be connected to the Internet while downloading.
- Run with the built-in demo (default query and planet documents):
$ python3 embeddinggemma.py- Similarity search with custom query and documents:
$ python3 embeddinggemma.py \
--query "What is the Red Planet?" \
--documents "Mercury is closest to the Sun" "Mars is called the Red Planet" "Saturn has rings"- Document input: pass one or more strings after
--documents. The option can be repeated to group documents, e.g.:
$ python3 embeddinggemma.py --documents "Doc A" "Doc B" --documents "Doc C"Pytorch
ONNX opset=17