quick and easy local translation CLI using MADLAD-400-3b-MT
Rust
1
4 commits
updated Feb 3, 2025
Run MADLAD-400 3b-MT model locally on your computer.
Utilize HuggingFace Hub to download the model locally and Candle as the inference engine.
I created this since there's no simple way to do the inference locally that I like or could find, code based on Candle examples but repurposed only for MADLAD-400 use case.
If you want to do GPU computing, you need:
git clone https://github.com/noaione/madlad-local.gitcargo build --release
cargo build --release --features cuda-compute./target/release/madlad.exeYou can use madlad like this:
madlad.exe --target ja "The quick brown fox jumps over the lazy dog"
Which should output something like this:
✨✨✨✨ MADLAD-400-3B-MT ✨✨✨✨
[?] Loading config from [REDACTED]\models--jbochi--madlad400-3b-mt\snapshots\bb45f1851bf13a0b8f4fcd9ecadf2cdb7cf22439\config.json
[?] Loading tokenizer from [REDACTED]\models--jbochi--madlad400-3b-mt\snapshots\bb45f1851bf13a0b8f4fcd9ecadf2cdb7cf22439\tokenizer.json
[?] Loading weights from [REDACTED]\models--jbochi--madlad400-3b-mt\snapshots\bb45f1851bf13a0b8f4fcd9ecadf2cdb7cf22439\model-q4k.gguf
[?] Loaded config: [REDACTED]\models--jbochi--madlad400-3b-mt\snapshots\bb45f1851bf13a0b8f4fcd9ecadf2cdb7cf22439\config.json
[?] Loaded tokenizer: [REDACTED]\models--jbochi--madlad400-3b-mt\snapshots\bb45f1851bf13a0b8f4fcd9ecadf2cdb7cf22439\tokenizer.json
[?] Tokenizing input...
[?] Creating input tensor...
[?] Building model...
[?] Creating output tensor...
[?] Creating logits processor...
[?] Encoding input tokens...
[?] Inferencing...
[!] Input: The quick brown fox jumps over the lazy dog
[!] Output: 速い褐色狐は怠け犬を飛び越えた
17 tokens generated (28.29 token/s)
MADLAD-400 are able to infer the source language automatically, so you only need to provide the target language.
For full list of supported languages, run madlad.exe --help
There's also more configuration that you can set, see madlad.exe --help
MIT License
4 commits
Rust
94.9%
PowerShell
5.1%
quick and easy local translation CLI using MADLAD-400-3b-MT
Rust
1
4 commits
updated Feb 3, 2025
Run MADLAD-400 3b-MT model locally on your computer.
Utilize HuggingFace Hub to download the model locally and Candle as the inference engine.
I created this since there's no simple way to do the inference locally that I like or could find, code based on Candle examples but repurposed only for MADLAD-400 use case.
If you want to do GPU computing, you need:
git clone https://github.com/noaione/madlad-local.gitcargo build --release
cargo build --release --features cuda-compute./target/release/madlad.exeYou can use madlad like this:
madlad.exe --target ja "The quick brown fox jumps over the lazy dog"
Which should output something like this:
✨✨✨✨ MADLAD-400-3B-MT ✨✨✨✨
[?] Loading config from [REDACTED]\models--jbochi--madlad400-3b-mt\snapshots\bb45f1851bf13a0b8f4fcd9ecadf2cdb7cf22439\config.json
[?] Loading tokenizer from [REDACTED]\models--jbochi--madlad400-3b-mt\snapshots\bb45f1851bf13a0b8f4fcd9ecadf2cdb7cf22439\tokenizer.json
[?] Loading weights from [REDACTED]\models--jbochi--madlad400-3b-mt\snapshots\bb45f1851bf13a0b8f4fcd9ecadf2cdb7cf22439\model-q4k.gguf
[?] Loaded config: [REDACTED]\models--jbochi--madlad400-3b-mt\snapshots\bb45f1851bf13a0b8f4fcd9ecadf2cdb7cf22439\config.json
[?] Loaded tokenizer: [REDACTED]\models--jbochi--madlad400-3b-mt\snapshots\bb45f1851bf13a0b8f4fcd9ecadf2cdb7cf22439\tokenizer.json
[?] Tokenizing input...
[?] Creating input tensor...
[?] Building model...
[?] Creating output tensor...
[?] Creating logits processor...
[?] Encoding input tokens...
[?] Inferencing...
[!] Input: The quick brown fox jumps over the lazy dog
[!] Output: 速い褐色狐は怠け犬を飛び越えた
17 tokens generated (28.29 token/s)
MADLAD-400 are able to infer the source language automatically, so you only need to provide the target language.
For full list of supported languages, run madlad.exe --help
There's also more configuration that you can set, see madlad.exe --help
MIT License
4 commits
Rust
94.9%
PowerShell
5.1%