onmt-runner
onmt-runner loads legacy (OpenNMT-py 1.x-style) recurrent .pt checkpoints
without installing OpenNMT-py or its obsolete torchtext dependency.
from onmt_runner import Translator
translator = Translator.load("murre_norm_default.pt")
print(translator.translate("h e i"))
print(translator.translate_many(["h e i", "m i t ä"]))
OpenNMT-tf SavedModel directories use the same loading entry point after installing the optional TensorFlow dependency:
python -m pip install 'onmt-runner[tensorflow]'
from onmt_runner import Translator
translator = Translator.load("flags_dist")
print(translator.translate("Kainuu h e i"))
Some older OpenNMT-tf exports use the retired TensorFlow Addons GatherTree
operation. onmt_runner transparently compiles a small CPU compatibility op
on first use; a C++17 compiler such as g++ must be available for those
exports.
Input must already be tokenized exactly as it was during training. For a
character model, that normally means characters separated by spaces. Returned
tokens are joined with spaces by default; pass detokenize=lambda tokens: "".join(tokens) to translate or translate_many for character output.
Supported checkpoints
The initial release supports the common OpenNMT-py 1.x text checkpoint format
whose opt.decoder_type is rnn, including bidirectional LSTM encoders,
input-feeding decoders, and dot/general global attention. It deliberately
does not execute serialized OpenNMT code: only tensor weights and vocabulary
metadata are read. As with torch.load(..., weights_only=False), only load
checkpoints you trust: historic OpenNMT checkpoints use Python pickle.
Transformer, copy-attention, and non-text checkpoints raise a precise
UnsupportedCheckpointError rather than producing unreliable output.
Building a wheel
python -m pip install -r requirements.txt
python setup.py bdist_wheel
The resulting wheel is written to dist/. A standards-based alternative is
python -m pip install build && python -m build.
Metadata
Release files for onmt-runner 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| onmt_runner-1.0.0.tar.gz | 11.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| onmt_runner-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.5 kB
Release files / onmt_runner-1.0.0.tar.gz
| Download URL | onmt_runner-1.0.0.tar.gz |
|---|---|
| Size | 11.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
49fe2540fb80ca60982dd013ec55b0e83d6a6c7d5c22b48b8895d756bfa6a82f
|
|
BLAKE2b-256 checksum How to use checksums |
9e21e72e211aa3b94ce09083e644aa19236916eeebd795e08cf14c831a0a7944
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / onmt_runner-1.0.0-py3-none-any.whl
| Download URL | onmt_runner-1.0.0-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e65d1b4bf94d598013cccdc461a2e31ee3a72e59412ed62fd8552e4c3a6db171
|
|
BLAKE2b-256 checksum How to use checksums |
4d4c81554e1412c2d9440e15f0161e27f9e2d21381c51f644987fd49a3ac9772
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|