Skip to content

Commit 68a2853

Browse files
authored
docs: Updated readme (#4)
1 parent 9e8a559 commit 68a2853

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# model2vec-rs
22

3-
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.
3+
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.
44

55
## Quick Start
66

@@ -18,10 +18,11 @@ Make embeddings:
1818

1919
```rust
2020
use anyhow::Result;
21-
use model2vec_rust::inference::StaticModel;
21+
use model2vec_rs::model::StaticModel;
2222

2323
fn main() -> Result<()> {
2424
// Load a model from the Hugging Face Hub or a local path
25+
// args = (repo_or_path, token, normalize, subfolder)
2526
let model = StaticModel::from_pretrained("minishlab/potion-base-8M", None, None, None)?;
2627

2728
// Prepare a list of sentences
@@ -48,4 +49,22 @@ cargo run -- encode "Hello world" minishlab/potion-base-8M
4849
# Multiple lines from a file
4950
echo -e "Hello world\nRust is awesome" > input.txt
5051
cargo run -- encode input.txt minishlab/potion-base-8M --output embeds.json
52+
```
53+
54+
55+
Make embeddings with custom encode args:
56+
57+
```rust
58+
let embeddings = model.encode_with_args(
59+
&texts, // input texts
60+
false, // show progress
61+
Some(512), // max length
62+
1204, // batch size
63+
true, // use multiprocessing
64+
10_000, // multiprocessing threshold
65+
);
66+
```
67+
68+
## License
5169

70+
MIT

0 commit comments

Comments
 (0)