ctranslate2-rs
Library Listed
Rust bindings for OpenNMT/CTranslate2
- Downloads
- 10,244
- Dependents
- 6
- Stars
- 63
- Forks
- 18
- Contributors
- 9
- Commits
- 490
- Latest release
- 0.10.4 ·
About
This library provides Rust bindings for OpenNMT/CTranslate2.
Usage
Add this crate to your Cargo.toml with selecting the backends you want to use as the features:
[dependencies]
ct2rs = { version = "0.10.4", features = ["cuda", "dnnl", "mkl"] }
Or you can use platform-specific default features by using the ct2rs-platform crate:
[dependencies]
ct2rs = { version = "0.10.4", package = "ct2rs-platform" }
If you want Whisper model support,
you need to enable the whisper feature.
See below for more details about the available features.
Prerequisites
The installation of CMake is required to compile the library.
Additional notes for Windows
Setting the environment variable RUSTFLAGS=-C target-feature=+crt-static might be required.
Features
Backend Futures
cuda: Enables CUDA supportcudnn: Enables cuDNN support
The above features require setting the CUDA_TOOLKIT_ROOT_DIR environment variable appropriately.
Read the full README
mkl: Enables Intel MKL supportsystem-mkl: Enables Intel MKL support using the system-installed MKL library instead of downloading and building itopenblas: Enables OpenBLAS support (OpenBLAS needs to be installed manually via vcpkg on Windows)dnnl: Enables oneDNN supportruy: Enables Ruy supportaccelerate: Enables Apple Accelerate support (macOS only)openmp-runtime-comp: Enables OpenMP runtime supportopenmp-runtime-intel: Enables OpenMP runtime support for Intel compilersdisable-cpu-dispatch: Disables CPU kernel dispatching at runtime (should be set when explicitly targeting an architecture)
Multiple features can be enabled at the same time.
To enable Streaming SIMD Extensions 4.1 (SSE4.1), add the -C target-feature=+sse4.1 flag to RUSTFLAGS environment
variable.
By default, the ruy feature is enabled.
If you want to use platform-specific default features, use the ct2rs-platform crate.
GPU-Specific Features
flash-attention: Enables Flash Attentiontensor-parallel: Enables Tensor Parallelismcuda-dynamic-loading: Enables dynamic loading of CUDA libraries at runtime instead of static linking (requires CUDA >= 11)cuda-small-binary: Reduces binary size by compressing device code
Tokenizer Features
sentencepiece: Enables SentencePiece tokenizer supporttokenizers: Enables HuggingFace's Tokenizers library supportall-tokenizers: Enables bothsentencepieceandtokenizerssupport
Additional Features
whisper: Enables Whisper model supporthub: Enables HuggingFace Hub integrationsystem: Skip compiling CTranslate2 and use the system's pre-installed shared library instead (requires setting the appropriate environment variables to locate the CTranslate2 shared library)
Platform Specific Features
When ct2rs-platform is used, the following features are automatically selected based on the platform:
- Windows:
openmp-runtime-intel,dnnl,cuda,cudnn,cuda-dynamic-loading,mkl - Intel MacOS:
dnnl,mkl - Apple Silicon MacOS:
accelerate,ruy - Linux (non-ARM):
dnnl,openmp-runtime-comp,cuda,cudnn,cuda-dynamic-loading,mkl,tensor-parallel - Linux (ARM):
openmp-runtime-comp,openblas,ruy
Supported Models
The ct2rs crate has been tested and confirmed to work with the following models:
- BART
- BLOOM
- FALCON
- Marian-MT
- MPT
- NLLB
- GPT-2
- GPT-J
- OPT
- T5
- Whisper
Please see the respective examples for each model.
Stream API
This crate also offers a streaming API that utilizes callback closures. Please refer to the example code for more information.
Model Conversion for CTranslate2
To use model files with CTranslate2, they must first be converted.
Below is an example of how to convert the nllb-200-distilled-600M model:
pip install ctranslate2 huggingface_hub torch transformers
ct2-transformers-converter --model facebook/nllb-200-distilled-600M --output_dir nllb-200-distilled-600M \
--copy_files tokenizer.json
For more details, please refer to the CTranslate2's docs.
Development
When using mise in this repository, sccache is enabled by default for Rust and C/C++
compilation. Run mise install first. CTranslate2 and its dependencies are still built from source; cached compiler
outputs can speed up later builds. The first build with an empty cache may be slower.
mise builds use target/sccache to keep their CMake configuration separate from builds without sccache. To run a
build without sccache in a POSIX shell, use a separate target directory:
env -u RUSTC_WRAPPER -u CMAKE_C_COMPILER_LAUNCHER -u CMAKE_CXX_COMPILER_LAUNCHER \
CARGO_TARGET_DIR=target/no-sccache cargo build -p ct2rs --release
Use the same target directory when switching back to cached builds only after reconfiguring CMake; otherwise its cached
compiler launcher settings may persist. cargo clean under mise only cleans the active CARGO_TARGET_DIR.
These settings are local development defaults and are not required for users of the published crate.
License
This application is released under the MIT License. For details, see the LICENSE file.
CTranslate2 (which this crate builds and links to) is licensed under MIT License. If you redistribute binaries or source that include CTranslate2, you must comply with the MIT terms, including preserving license and notice files. For details, see CTranslate2’s upstream LICENSE/NOTICE.
The published crate may build and/or redistribute artifacts originating from the following third-party projects. Each component remains under its own license, which applies in addition to this crate’s MIT license. When redistributing your software, ensure that you include the required attributions and license texts for any components that were used by your build configuration and target platform. The exact set of components used can depend on enabled features, target architecture, and toolchain.
The published crate also includes the following libraries:
BSD-2-Clause:
BSD-3-Clause:
Apache License 2.0:
MIT License:
Compatibility
- Runs on
- CUDA
What shows it
- CUDA: ct2rs feature cuda, ct2rs-platform feature cuda
- Native code
- Required
- Binds native code: cxx, link-cplusplus, intel-onemkl-prebuild (feature mkl), onednn-src (feature dnnl), openblas-src (feature openblas) and 1 more
- Build uses a native toolchain: cmake, cxx-build
- Python bindings
- No Python binding crate found
- License
- MIT
Compare with similar projects
Order: strongest tier first, then most downloads, then name, with unmeasured values last. A library counts downloads over 30 days. An app counts binary downloads per release. An app with none counts its crate downloads over 30 days. ML Rust runs this catalogue, so its closest project always gets a row.
| Project | Downloads | Dependents | Stars | Latest release | Runs on (GPU) | Native code | License |
|---|---|---|---|---|---|---|---|
|
Rust bindings for OpenNMT/CTranslate2 |
10,244 downloads over 30 days | 6 | 63 | 0.10.4 | CUDA | Binds native code: cxx, link-cplusplus, intel-onemkl-prebuild (feature mkl), onednn-src (feature dnnl), openblas-src (feature openblas) and 1 more. Build uses a native toolchain: cmake, cxx-build | MIT |
|
ort Featured
A safe Rust wrapper for ONNX Runtime 1.31 - Optimize and accelerate machine learning inference & training |
3,902,768 downloads over 30 days | 694 | 2,611 | 2.0.0-rc.15 | CUDA, WebGPU, ROCm | Binds native code: onnxruntime, ort-sys. Build uses a native toolchain: pkg-config (feature pkg-config) | Apache-2.0 OR MIT |
|
llama-cpp-rs Featured
llama.cpp bindings for Rust |
341,382 downloads over 30 days | 98 | 665 | 0.1.161 | CUDA, WebGPU, Metal, ROCm, Vulkan | Binds native code: llama. Build uses a native toolchain: bindgen, cc, cmake | Apache-2.0 OR MIT |
|
Rust bindings for TensorFlow Lite |
550 downloads over 30 days | 1 | 129 | 0.9.8 | GPU support unknown | Build uses a native toolchain: bindgen | Apache-2.0 OR MIT |
|
Inference server for LLMs, speech and embeddings: OpenAI-compatible routes with streaming, plus speech synthesis (TTS) and transcription (ASR). Serves Llama, Mistral, Qwen, Mamba2, MLA+MoE and hybrid models from SafeTensors, AWQ, GPTQ and GGUF. |
8 binary downloads per release | Not applicable | 7 | 0.7.1 | CUDA, WebGPU | Binds native code: ring (feature distributed) | Apache-2.0 |
|
oxibonsai Listed
Pure Rust 1-bit LLM inference engine for PrismML Bonsai models — umbrella crate |
1 downloads over 30 days | 0 | 137 | 0.2.3 | CUDA, Metal | No native code found | Apache-2.0 |
|
baseRT New
Safe Rust bindings for the BaseRT LLM inference engine (Apple Silicon) |
49 downloads over 30 days | 2 | 247 | 0.4.6 | GPU support unknown | Binds native code: baseRT, baseRT-sys | Apache-2.0 |
All projects in Run and serve modelsAll projects in Text, embeddings and search
Why ListedNo archive, New or Featured rule places it, so it is Listed.
What it lacks for Featured
- It has 5 active dependents and 5 new dependents in 365 days. Featured needs 11 active dependents or 9 new dependents in 365 days. The repository route reads 63 stars, 18 forks and 9 contributors. It needs 4,539 stars, 434 forks and 79 contributors together.
What else the check found
- The last activity is on 3 Nov 2026, 6 days ago. The rules expect an update within 450 days. Dormancy rule
Exact rules: Listed, Featured library. The check on applied thresholds version 9.
Every rule outcome, as the check records it
expected-interval: version 0.10.4 base 450: E = 450 daysdormancy: last activity 2026-11-03, 6 days ago, E = 450: activefeatured: not featured: active_users 5 < 11 and new_adopters 5 < 9 and repository route stars 63 (needs 4539), forks 18 (needs 434), contributors 9 (needs 79)listed: listed: no archive, new or featured rule applies
Crates2 crates
- ct2rs Primary
- ct2rs-platform
Measurements and sources
Each signal row shows the raw value, its source and the fetch date. The Sources list gathers every distinct source on this page. Movement needs more history.
Sources6 sources
- Description: the crates.io description
- crates.io database dump, fetched
- RustSec advisory database, fetched
- GitHub repository, fetched
- crates.io package, fetched
- GitHub contributors, fetched
Adoption5 active dependents, 5 new dependents in 365 days1 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Active dependents | 5 | crates.io database dump | Yes | |
| New dependents (365 days) | 5 | crates.io database dump | Yes | |
| Peak active dependents | 5 | crates.io database dump | Yes | |
| Active dependents as a share of the peak | 1 | crates.io database dump | Yes | |
| Binary downloads per release | Not measured | Yes |
MaintenanceLatest human commit: 6 days ago3 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Latest human commit | 2026-11-03 | GitHub repository | Yes | |
| Latest release | 2026-11-03 | crates.io database dump | Yes | |
| First release | 2024-04-14 | crates.io database dump | Yes | |
| Latest version | 0.10.4 | crates.io database dump | Yes | |
| Days the oldest outside issue waits for a reply | 206 | GitHub repository | Yes | |
| Maintainer replies over 365 days | 16 | GitHub repository | Yes | |
| Repository archived | false | GitHub repository | Yes | |
| Repository gone | false | GitHub repository | Yes | |
| Release commit or manifest in the repo | true | crates.io package | Yes | |
| Published docs | true | crates.io database dump | Yes | |
| Latest release fails cargo check | Not measured | Yes | ||
| Build check date | Not measured | Yes | ||
| Build check toolchain | Not measured | Yes |
SecurityUnpatched vulnerabilities: none
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Unpatched vulnerabilities past the grace window | none | RustSec advisory database | Yes | |
| RustSec unmaintained advisory | none | RustSec advisory database | Yes | |
| Deprecation notice | none | crates.io database dump | Yes | |
| Deprecated requirement | none | crates.io database dump | Yes |
Distribution44 releases, 10,244 downloads over 30 days5 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Releases | 44 | crates.io database dump | Yes | |
| Downloads over 30 days | 10244 | crates.io database dump | Yes | |
| Binary downloads over the last 3 releases | Not measured | Yes | ||
| Homebrew installs on request over 365 days | Not measured | Yes | ||
| Repology repository families | Not measured | Yes | ||
| Docker pull growth over 90 days | Not measured | Yes | ||
| Docker pulls at the growth baseline | Not measured | Yes | ||
| Every version a prerelease | false | crates.io database dump | Yes | |
| Every version 0.0.x | false | crates.io database dump | Yes | |
| Every version yanked | false | crates.io database dump | Yes | |
| Crate deleted from crates.io | false | crates.io database dump | Yes |
Repository63 stars, 18 forks, 9 contributors, 490 commits. Stars alone never qualify a project.
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| GitHub stars | 63 | GitHub repository | Yes — one part of the repository route | |
| GitHub forks | 18 | GitHub repository | Yes — one part of the repository route | |
| Contributors with a GitHub account | 9 | GitHub contributors | Yes — one part of the repository route | |
| Commits on the default branch | 490 | GitHub repository | No | |
| Repository's main crate left out of the entry | none | crates.io database dump | Yes |
Facts that never count
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| License | MIT | crates.io database dump | No | |
| Runs on, from listed crates and their direct dependencies | CUDA | crates.io database dump | No | |
| What shows each backend | CUDA: ct2rs feature cuda, ct2rs-platform feature cuda | crates.io database dump | No | |
| Native code, from listed crates and their dependencies | Binds native code: cxx, link-cplusplus, intel-onemkl-prebuild (feature mkl), onednn-src (feature dnnl), openblas-src (feature openblas) and 1 more. Build uses a native toolchain: cmake, cxx-build | crates.io database dump | No | |
| Python bindings, from direct dependencies of listed crates | No Python binding crate found | crates.io database dump | No | |
| Crates that depend on a listed crate directly | 6 | crates.io database dump | No |
Corrections and review history
No correction applies to this entry.
Judgments
A judgment enters only through an approved issue and a merged pull request.
No judgment applies to this entry.