From 55b30671a88bf77d9ff59a77523f36855c42ada7 Mon Sep 17 00:00:00 2001 From: Pringled Date: Mon, 12 May 2025 08:30:05 +0200 Subject: [PATCH] Updated readme --- README.md | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dba00bf..a6090d3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # model2vec-rs -This crate provides a lightweight Rust implementation for loading and running inference on Model2Vec static embedding models (including quantized formats: float32, float16, int8) from either local folders or the Hugging Face Hub. +This crate provides a lightweight Rust implementation for loading and running inference on [Model2Vec](https://github.com/MinishLab/model2vec) static embedding models from either local folders or the Hugging Face Hub. ## Quick Start @@ -18,10 +18,11 @@ Make embeddings: ```rust use anyhow::Result; -use model2vec_rust::inference::StaticModel; +use model2vec_rs::model::StaticModel; fn main() -> Result<()> { // Load a model from the Hugging Face Hub or a local path + // args = (repo_or_path, token, normalize, subfolder) let model = StaticModel::from_pretrained("minishlab/potion-base-8M", None, None, None)?; // Prepare a list of sentences @@ -48,4 +49,22 @@ cargo run -- encode "Hello world" minishlab/potion-base-8M # Multiple lines from a file echo -e "Hello world\nRust is awesome" > input.txt cargo run -- encode input.txt minishlab/potion-base-8M --output embeds.json +``` + + +Make embeddings with custom encode args: + +```rust +let embeddings = model.encode_with_args( + &texts, // input texts + false, // show progress + Some(512), // max length + 1204, // batch size + true, // use multiprocessing + 10_000, // multiprocessing threshold +); +``` + +## License +MIT \ No newline at end of file