Utilities related to the use of OpenNMT
Project description
RXN package for OpenNMT-related utilities
This repository contains OpenNMT-related utilities used in the RXN universe.
For general utilities not related to OpenNMT, see our other repository rxn-utilities
.
Links:
System Requirements
This package is supported on all operating systems. It has been tested on the following systems:
- macOS: Big Sur (11.1)
- Linux: Ubuntu 18.04.4
A Python version of 3.6, 3.7, or 3.8 is recommended. Python versions 3.9 and above are not expected to work due to compatibility with the selected version of OpenNMT.
Installation guide
The package can be installed from Pypi:
pip install rxn-onmt-utils
For local development, the package can be installed with:
pip install -e ".[dev]"
Package highlights
Translate with OpenNMT from Python code
By importing the following,
from rxn.onmt_utils import Translator, translate
you can do OpenNMT translations directly in Python.
The translate
function acts on input/output files, while the Translator
class gives you flexibility for getting translation results on strings directly.
Stripping models
The script rxn-strip-opennmt-model
installed the package allows you to strip ~2/3 of the size of model checkpoints by removing the state of the optimizer.
You can do this safely if you don't need to continue training on these checkpoints.
Extending the model vocabulary
If you finetune a model on a dataset with additional tokens compared to the base model, you will need to extend the model weights.
The script rxn-extend-model-with-vocab
does that for you.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file rxn-onmt-utils-1.1.0.tar.gz
.
File metadata
- Download URL: rxn-onmt-utils-1.1.0.tar.gz
- Upload date:
- Size: 15.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76f8d4a94e521ff7d04a2a0b8055da32fdd39f33ff210cb62792669a755e2ba3 |
|
MD5 | 08bf69f88155d8235b857d65ddc75937 |
|
BLAKE2b-256 | 2416aadae28f8295329cea999557b58ae6d7d7d24d90de21304b0ea2c86a3a4f |
File details
Details for the file rxn_onmt_utils-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: rxn_onmt_utils-1.1.0-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08243dc198c6e2693882c6a2c31f5dfc4f537e4eb7a8978f6f90c09cf800cf22 |
|
MD5 | 7b61ca054bea0f152c001409b7b29af8 |
|
BLAKE2b-256 | 81f0891fbf009ec737cb6088e4e11b574bae69a14cbf9c46dd1d7af64dae3ed1 |