bergamot-translator/examples/run-native.sh
Jerin Philip 7099b9e9ad
Streamline memory-bundle loads (#307)
Provides an additional constructor which takes care of the bundle
loading inside the boundary of the source here, when a configuration
file is supplied from a client like translateLocally or python bindings.
Once the config file is read, we have access to the information required
to construct the MemoryBundle.

 - The command-line application supplied from here, app/bergamot is
   configured to use the fast-load path now.
 - Changes to binary-loading additionally revealed a bug in the
   example-run script used in docs and tied to CI and the fix is
   included.
 - Shortlist is made optional in the memory bundle, making changes to
   getModelMemoryFromConfig.

Fixes #304.
Fixes #306.
See also: XapaJIaMnu/translateLocally#82.
2022-01-19 16:36:48 +00:00

20 lines
812 B
Bash

# In source-root folder
# Obtain an example model from the web.
mkdir -p models
wget --quiet --continue --directory models/ \
http://data.statmt.org/bergamot/models/deen/ende.student.tiny11.tar.gz
(cd models && tar -xzf ende.student.tiny11.tar.gz)
# Patch the config-files generated from marian for use in bergamot.
python3 bergamot-translator-tests/tools/patch-marian-for-bergamot.py \
--config-path models/ende.student.tiny11/config.intgemm8bitalpha.yml \
--ssplit-prefix-file $(realpath 3rd_party/ssplit-cpp/nonbreaking_prefixes/nonbreaking_prefix.en)
# Patched config file will be available with .bergamot.yml suffix.
CONFIG=models/ende.student.tiny11/config.intgemm8bitalpha.yml.bergamot.yml
build/app/bergamot --model-config-paths $CONFIG --cpu-threads 4 <<< "Hello World!"
# Hallo Welt!