- Notifications
You must be signed in to change notification settings - Fork1
A plugin to use a local TorchScript translation model in OmegaT.
License
mitre/omegat-pytorch-plugin
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This repo serves to enable translators using OmegaT to add plugin support for TorchScript models. Currently it supports scripted fairseq models by wayjFairseq.
The plugin can be built usingsbt clean assembly
. Once this is done, the resulting artifact./target/omegat-torchscript-plugin-1.0-SNAPSHOT-XYZ.jar
will need to be moved to the OmegaT plugins directory whereXYZ
is the platform information of the target OmegaT installation.
Because TorchScript support relies on native code a la libtorch, the OmegaT jar will need to be invoked with a java option indicating the location to the libtorch bundle:
% java -jar -Djava.library.path=$LIBTORCH_HOME /path/to/OmegaT.jar
where$LIBTORCH_HOME
is/path/to/libtorch/lib/
. Note: libtorch is platform-dependent, so be sure to download the appropriate libtorch for the operating system on which OmegaT will be running.
In addition, because of differences in native library loading on Windows, the path will need to be updated to include$LIBTORCH_HOME
so all native dependencies can be located by library loader.
Currently Windows support is only ensured for PyTorch 1.7.1 nightlies as of 2 December 2020 and above, though non-Windows support is guaranteed for 1.5+.
Tests can be run by issuingsbt test
.