Skip to main content

Crate pocket_encoder

Crate pocket_encoder 

Source
Expand description

Bundled sentence-transformer embeddings, offline, with native Rust CPU inference.

This runs all three attention layers of MiniLM. The 4-bit storage format is dequantized to F32 once at load; inference is F32, not an integer kernel. No model downloads, Python, ONNX shared library, cache or build script.

let encoder = pocket_encoder::Encoder::new()?;
let vectors = encoder.embed(&["Send a document", "Transfer a file"])?;
assert_eq!(vectors[0].len(), 384);

Enable the search feature for an exact cosine index with compact binary storage. Embedding-only users do not compile the index API.

Structs§

Encoder
Cheap clones share immutable weights and tokenizer; CPU only.
ModelInfo
Embedding coordinate-space identity. Persist this with indexed vectors. Exact equality, not just equal dimensions, is required before comparison.

Enums§

Error
Validation or native inference failure. Input text is never included.

Functions§

model_info
Metadata is available without loading weights or doing inference.