Installion
uv pip install fastertext
Usage
On a model such as glotlid you should expect around a 7x-10x speedup compared to regular fasttext.
! wget https://huggingface.co/cis-lmu/glotlid/resolve/main/model_v3.bin
from fastertext import load_model
model = load_model("model_v3.bin")
labels, probs = model.batch(["hello world", "bonjour le monde"], k=2)
id2label = model.get_labels()
print(id2label[int(labels[0, 0])], probs[0, 0])
Benchmark on longer Wikipedia documents
fastertext: 2.93s 34,114 texts/s
fasttext: 17.84s 5,604 texts/s
speedup: 6.1x
top-1 agreement: 100.0000%
Contributing
Need to support many linux builds through docker container to publish release wheels:
set -e
rustup target add x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu
uv pip install 'maturin[zig]'
for rust_target in x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu; do
maturin build --release --zig --target "$rust_target" --compatibility manylinux2014
done
uv publish target/wheels/*.whl
Citations
@misc{shippole2026fastertext,
author = {Shippole, Enrico},
title = {fastertext: embarrassingly parallel fasttext batch inference in rust},
year = {2026},
howpublished = {\url{https://github.com/teraflop-ai/fastertext}}
}
@article{joulin2016bag,
title={Bag of Tricks for Efficient Text Classification},
author={Joulin, Armand and Grave, Edouard and Bojanowski, Piotr and Mikolov, Tomas},
journal={arXiv preprint arXiv:1607.01759},
year={2016}
}
@article{bojanowski2016enriching,
title={Enriching Word Vectors with Subword Information},
author={Bojanowski, Piotr and Grave, Edouard and Joulin, Armand and Mikolov, Tomas},
journal={arXiv preprint arXiv:1607.04606},
year={2016}
}
@misc{messense_fasttext_rs,
author = {messense},
title = {fasttext-rs: fastText Rust binding},
howpublished = {\url{https://github.com/messense/fasttext-rs}}
}
@misc{wang_fasttext_parallel,
author = {Congyu Wang},
title = {fasttext-parallel: multithreaded batch processing for fasttext},
howpublished = {\url{https://github.com/Congyuwang/fasttext-parallel}}
}
Release files for fastertext 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fastertext-0.1.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| fastertext-0.1.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ ARM64 | Details |
Total release size: 728.1 kB
Release files / fastertext-0.1.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | fastertext-0.1.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 374.6 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
ce284083e45d4a294ff9a2587b1843da74108c21146b980cf459562b74874900
|
|
BLAKE2b-256 checksum How to use checksums |
c29eb65e503bb14cb4a62f6fe579692eb588ceb59ce544b165524d215e086bb9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / fastertext-0.1.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | fastertext-0.1.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 353.5 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
64c4dcc7faf50d18e54ea93dfb1dd1c0ed622680d3af34928a6eb5e4797137b1
|
|
BLAKE2b-256 checksum How to use checksums |
543bc6c190ecbb4424e2b86c7e2fcf48dcecc2955fe928b842bf3f0b15a3c5cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|