Skip to content

Install

pito-embed is a Rust library. It isn’t on crates.io: both crates come from the GitHub repository and pin the same tag. It needs Rust 1.97 or newer, and the build downloads ONNX Runtime’s prebuilt libraries through the ort crate.

Debian and Ubuntu; other distributions need the same three packages.

Terminal window
sudo apt-get install -y build-essential pkg-config libssl-dev

Xcode’s command line tools:

Terminal window
xcode-select --install

Use WSL and follow the Linux steps inside it.

[dependencies]
embed = { git = "https://github.com/gmrdad82/pito-embed.git", tag = "v1.0.1" }
probe = { git = "https://github.com/gmrdad82/pito-embed.git", tag = "v1.0.1" }

The default vulkan feature runs the model on the GPU on Linux. For a CPU-only build, turn it off:

embed = { git = "https://github.com/gmrdad82/pito-embed.git", tag = "v1.0.1", default-features = false }

Clone the repository and run the search example. It downloads the model once (219 MB, sha256 checked), loads it on your GPU and ranks eight lines against your query:

Terminal window
git clone https://github.com/gmrdad82/pito-embed && cd pito-embed
cargo run --release --example search -- a hidden area
downloaded config.json, sha256 checked
…
downloaded onnx/model_q4.onnx_data, sha256 checked
loaded EmbeddingGemma-300m on Vulkan in 1725 ms
embedded 8 lines and the query in 93 ms, 768 dimensions each
query: a hidden area
0.567 found a secret room behind the waterfall
0.295 we finally beat the final boss on hard
0.289 the soundtrack in this level is incredible

The download lines show only on the first run. On a machine without a GPU the first line names the processor instead of Vulkan. Then read Search by meaning to do the same in your own code.