https://github.com/frederik-uni/rustyctranslate2
use ctranslate2 in rust
https://github.com/frederik-uni/rustyctranslate2
ctranslate2 rust-library translation
Last synced: 10 months ago
JSON representation
use ctranslate2 in rust
- Host: GitHub
- URL: https://github.com/frederik-uni/rustyctranslate2
- Owner: frederik-uni
- Created: 2023-05-10T17:12:53.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2025-07-02T16:02:53.000Z (12 months ago)
- Last Synced: 2025-07-04T17:39:06.078Z (12 months ago)
- Topics: ctranslate2, rust-library, translation
- Language: Rust
- Homepage:
- Size: 37.1 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# rustyctranslate2
## Requirements
- cmake
- git
### MacOS arm64
/
### MacOS x86_64
- oneapi
- onednn
### Linux arm64
- libopenblas-dev
### Linux x86_64
- oneapi
- oneapi-dnnl/onednn
- openmpi
- cuda
- nncl
### Windows x86_64
- oneapi
- onednn
- cuda
- cuDNN
## Info
A simple project that wraps around [CTranslate2](https://github.com/OpenNMT/CTranslate2)
https://github.com/OpenNMT/CTranslate2/tree/master/python/tools
How to use?
```rs
let model = CTranslator::new(PathBuf::from_str("...").unwrap(), false);
let tokens = ["▁H", "ell", "o", "▁world", "!"].into_iter().map(|v| v.to_string()).collect();
let v = model.unwrap().translate_batch(vec![tokens], None, BatchType::Example);
println!("{:?}", v);
```