Description
rust-bert is a Rust library of state-of-the-art natural language processing models and ready-to-use pipelines. It is a port of Hugging Face's Transformers library, so transformer models such as BERT, DistilBERT and GPT-2 can be run from Rust. It uses tch-rs or ONNX Runtime bindings for the model computation, and rust-tokenizers for pre-processing, with multi-threaded tokenisation and GPU inference. The library exposes the base architectures, task-specific heads and pipelines, so a few lines of code can run question answering, named entity recognition, translation, summarisation, text generation or conversational agents. Tasks listed in the README include zero-shot classification, sentiment analysis, part-of-speech tagging, masked language modelling, sentence embeddings and keyword extraction. The README has a matrix of models against tasks, installation instructions for manual and automatic setup, and benchmarks at the end of the document. The project is on GitHub.…
Highlights
- Transformer models such as BERT, DistilBERT and GPT-2 in Rust
- Ready-to-use NLP pipelines
- Translation, summarisation, NER and question answering
- GPU inference and multi-threaded tokenisation
- tch-rs or ONNX Runtime backends
Ratings & Reviews
No ratings yet
Be the first to rate Rust Bert.
People also visit
Rust Bert FAQ
What is rust-bert?
A Rust-native library of NLP models and pipelines, ported from Hugging Face's Transformers library.
Which tasks does it support?
Translation, summarisation, multi-turn dialogue, zero-shot classification, sentiment analysis, named entity recognition, part-of-speech tagging, question answering, text generation, masked language modelling, sentence embeddings and keyword extraction.
Can it use my GPU?
Yes. The README says it supports GPU inference.
How do I install it?
The README gives manual and automatic installation options, and a section for verifying the installation.
Which backends does it use?
tch-rs or ONNX Runtime bindings for the models, with rust-tokenizers for pre-processing.
What are the best Rust Bert alternatives?
Popular alternatives to Rust Bert include Rig, Transformers.js and Deepseek-ocr.rs. See all Rust Bert alternatives


