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

encode accepts max_length (default 512, None for no limit) and batch_size (default None, which encodes all sentences in one parallel pass), and releases the GIL while encoding.

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.4.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.4.0
File Size Uploaded Provenance Actions
model2vec_rs-0.4.0.tar.gz 119.5 kB With provenance Details for model2vec_rs-0.4.0.tar.gz

Built distributions (wheels)

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

Total release size: 41.2 MB

Release files / model2vec_rs-0.4.0.tar.gz

Download URL model2vec_rs-0.4.0.tar.gz
Size 119.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f8440e4912e2f98273a4604a71e9805973f60728accbe79434d012d69edede4a
BLAKE2b-256 checksum
How to use checksums
a8438c472f5758beb754fcf63b3163dcce8db8cafa2f219b8aef28a17df3a9e9
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 18, 2026.

Transparency log

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

Download URL model2vec_rs-0.4.0-cp310-abi3-win_arm64.whl
Size 3.0 MB
Tags CPython 3.10 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
06f6cf3f5f38bab4e4c91f3efed0968782e76ceb960d0258d9f0e2b2a6c080ea
BLAKE2b-256 checksum
How to use checksums
61cd7b694356a72731ec2d034faad2f88410a2b010cacbc408e70faf976a4af9
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 18, 2026.

Transparency log

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

Download URL model2vec_rs-0.4.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
c16401d144a5654c62eac6e81189170fbca6be5e3d74b08bbcb0f01288149a10
BLAKE2b-256 checksum
How to use checksums
ee522baba4af95dab21421d7852c2400a299116c0b23b71d9bc4dd4cfbdca072
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 18, 2026.

Transparency log

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

Download URL model2vec_rs-0.4.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
766a72b18625b62f50ac7ab7a3cbe874b6a754708d4c666016e725724390e698
BLAKE2b-256 checksum
How to use checksums
f6c7489e5f89034c2a601c817f5a82c851cfac9b32c0785b945ce715393b9837
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 18, 2026.

Transparency log

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

Download URL model2vec_rs-0.4.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
886d8400e86694d398684b37ec1ef5cf7504f48de78440f3281f853066082b62
BLAKE2b-256 checksum
How to use checksums
215546eff02016a989a828d1c1bc9a2b4231ea4fd9a50b7adb43e2d844904cb2
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 18, 2026.

Transparency log

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

Download URL model2vec_rs-0.4.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
ca7dfac21fdf494ad044929d130538ea1604eb7fcac262d749ac999f07a14512
BLAKE2b-256 checksum
How to use checksums
6035e7383c7dcbff21052071304eb91333405921cee9a2a455ec4c118ab09f97
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 18, 2026.

Transparency log

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

Download URL model2vec_rs-0.4.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
24b7c849ed0ff03ab675aa6d9dcf03238a204148708281e6c1752582350abe24
BLAKE2b-256 checksum
How to use checksums
6da1f5fc803f13c86d311efd8df4625936312357de4e2edef87f46d5380eef42
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 18, 2026.

Transparency log

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

Download URL model2vec_rs-0.4.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
d668c857b8370b403a9c0843133a253404086b2ebf06b9f3d4aff816e24baff4
BLAKE2b-256 checksum
How to use checksums
c7e8de8fc51bdb725963c90ab52759bb2a19b76e2cc8358c9eb3138ae880dfb2
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 18, 2026.

Transparency log

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

Download URL model2vec_rs-0.4.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
2b74191a15e1e5973858a64dd381bacc150b2c9d1daf34200b2f23e255484f50
BLAKE2b-256 checksum
How to use checksums
3566c857931cba2677f73cc8d68c9e7989ae51ba8ea6a74aee218e470cacba67
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 18, 2026.

Transparency log

Security for model2vec-rs 0.4.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.4.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 18, 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