Skip to main content

model2vec-rs (Python)

Python bindings for model2vec-rs, the Rust implementation of Model2Vec.

Installation

pip install maturin
maturin develop --release   # from this directory

Usage

from model2vec_rs import StaticModel

model = StaticModel.from_pretrained("minishlab/potion-base-8M")

embeddings = model.encode(["Hello world", "Rust is awesome"])  # np.ndarray, shape (2, dim)
embedding = model.encode("Hello world")                        # np.ndarray, shape (dim,)

model.dim  # int
model.normalize  # bool, whether encode L2-normalizes by default
model.max_length  # int | None, the default max tokens per sentence for encode

encode accepts max_length (default: the model's max_length, None for no limit), batch_size (default None, which encodes all sentences in one parallel pass) and normalize (default None, which uses the model's setting), and releases the GIL while encoding.

As in model2vec, the model's max_length comes from its config (512 if unset, null for no limit). Override it with StaticModel.from_pretrained(..., max_length=...); from_arrays defaults to 512.

Performance

We encoded the same 666,808 Wikipedia paragraphs (11M words) with potion-base-8M using the Rust crate, these bindings, and Python model2vec:

Encoding throughput of Rust, the Python bindings and Python model2vec

On a single thread the bindings are about as fast as Rust and roughly 16× faster than model2vec; on all cores they are roughly 32× faster than model2vec.

To reproduce (from the repository root):

uv run --with ./python scripts/python_compare.py --bindings --rust-api flat --no-python-multiprocessing --out bindings.json
uv run scripts/bindings_chart.py bindings.json

Measured on an Apple M3 Pro with 5 alternating rounds per implementation, 5 timed passes each; throughput is the median over all passes. As in the main benchmark, model2vec runs with use_multiprocessing=False, which is faster than its default process pool. See scripts/python_compare.py for the options.

Metadata

Release files for model2vec-rs 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for model2vec-rs 0.5.0
File Size Uploaded Provenance Actions
model2vec_rs-0.5.0.tar.gz 122.0 kB With provenance Details for model2vec_rs-0.5.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for model2vec-rs 0.5.0
File Actions
model2vec_rs-0.5.0-cp310-abi3-win_arm64.whl CPython 3.10 abi3 Windows ARM64 Details for model2vec_rs-0.5.0-cp310-abi3-win_arm64.whl
model2vec_rs-0.5.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for model2vec_rs-0.5.0-cp310-abi3-win_amd64.whl
model2vec_rs-0.5.0-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details for model2vec_rs-0.5.0-cp310-abi3-musllinux_1_2_x86_64.whl
model2vec_rs-0.5.0-cp310-abi3-musllinux_1_2_aarch64.whl CPython 3.10 abi3 Linux musl 1.2+ ARM64 Details for model2vec_rs-0.5.0-cp310-abi3-musllinux_1_2_aarch64.whl
model2vec_rs-0.5.0-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details for model2vec_rs-0.5.0-cp310-abi3-manylinux_2_28_x86_64.whl
model2vec_rs-0.5.0-cp310-abi3-manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.28+ ARM64 Details for model2vec_rs-0.5.0-cp310-abi3-manylinux_2_28_aarch64.whl
model2vec_rs-0.5.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for model2vec_rs-0.5.0-cp310-abi3-macosx_11_0_arm64.whl
model2vec_rs-0.5.0-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for model2vec_rs-0.5.0-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 41.3 MB

Release files / model2vec_rs-0.5.0.tar.gz

Download URL model2vec_rs-0.5.0.tar.gz
Size 122.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bbbaaaaf37b4a74cf727b25b86f879461aeef7fd888d2796397189e51c06bcb3
BLAKE2b-256 checksum
How to use checksums
2a16bf51ffed707e2d4cff0369f883c60543c428fe271695e735fb7752b22800
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / model2vec_rs-0.5.0-cp310-abi3-win_arm64.whl

Download URL model2vec_rs-0.5.0-cp310-abi3-win_arm64.whl
Size 3.0 MB
Tags CPython 3.10 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
4ef7a52418d20de87ad47d90f4fdc0b5d332e874ee462b5bc25488d59c034952
BLAKE2b-256 checksum
How to use checksums
44b439a61420577fd24f53fb4d300d397e13ede7ee30525f899140ce6ca936e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / model2vec_rs-0.5.0-cp310-abi3-win_amd64.whl

Download URL model2vec_rs-0.5.0-cp310-abi3-win_amd64.whl
Size 3.1 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
d2f7bba50f596a12624db23a55b20fbe1c4e55c8641075f809d5ad4dd478f06f
BLAKE2b-256 checksum
How to use checksums
1c6df7db44c087a50e84f0978a8d77e17a39fa0d31653a8c23a8f6f21958226a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / model2vec_rs-0.5.0-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL model2vec_rs-0.5.0-cp310-abi3-musllinux_1_2_x86_64.whl
Size 10.5 MB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
d0f83176d47aaeb0077bf4e9ee05e724c31426da2ad339be703c380c1f0b44fc
BLAKE2b-256 checksum
How to use checksums
b0de283eccc7dde5594a37cae81e6e57959479bcac18acad45c613fa439fcd70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / model2vec_rs-0.5.0-cp310-abi3-musllinux_1_2_aarch64.whl

Download URL model2vec_rs-0.5.0-cp310-abi3-musllinux_1_2_aarch64.whl
Size 10.2 MB
Tags CPython 3.10 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
76fddbadfba3eeedf689b912459c1ff4b1e646d572112a7f21c06f34abae3270
BLAKE2b-256 checksum
How to use checksums
6e66a151f8f8ecf619c3426e4c2ca0e169777e090d9a04a9925f087a5d3b911e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / model2vec_rs-0.5.0-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL model2vec_rs-0.5.0-cp310-abi3-manylinux_2_28_x86_64.whl
Size 3.7 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
df3ce451a03c19c3eb9ea656cc46a2afc7796195fc083e034e8265e532a13f4b
BLAKE2b-256 checksum
How to use checksums
b318c2aa8af808018c16d6f8ca389657a1de66aecb5f274a3ae9d5839905f778
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / model2vec_rs-0.5.0-cp310-abi3-manylinux_2_28_aarch64.whl

Download URL model2vec_rs-0.5.0-cp310-abi3-manylinux_2_28_aarch64.whl
Size 3.8 MB
Tags CPython 3.10 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
120de979462eeb2ce8a472f2d05c00cc5496b0e3f7302852d288adc81d4a774d
BLAKE2b-256 checksum
How to use checksums
d645b2cb61741f5800023d61fc3e093ac68db6fa73ecc02b6477c55aca9845c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / model2vec_rs-0.5.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL model2vec_rs-0.5.0-cp310-abi3-macosx_11_0_arm64.whl
Size 3.3 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
afbc1127e6b360761abd25a5439e6756ca35f3df39c918ebcad57494c2572eeb
BLAKE2b-256 checksum
How to use checksums
b46950611b3c39ba9fc29fb121035a6e7edd3eb9495d1abaf8c1c9e0f84cc1b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / model2vec_rs-0.5.0-cp310-abi3-macosx_10_12_x86_64.whl

Download URL model2vec_rs-0.5.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 3.4 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
88b1d4c17d0353212365bcfdf754b63987e3a77aa89069458a2179e55730c828
BLAKE2b-256 checksum
How to use checksums
252d696960ff65159cda7d80dc734485af9c647bd07f26d33b64c485ebecfa98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Security for model2vec-rs 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 9 files in this release have been uploaded with provenance metadata.

Select from 9 files

Attestation for model2vec_rs-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page