Plug-in loader#
mbrs-decode and mbrs-score load plug-in modules via the --plugin_dir option.
Examples#
This tutorial explains how to load a user defined modules.
See also
- How to define a new metric
Detailed documentation of the metric customization.
- How to define a new decoder
Detailed documentation of the decoder customization.
Define a new metric, decoder, or selector with
@registerdecorator.from mbrs.metrics import register, Metric, MetricBLEU @register("my_bleu") class MetricMyBLEU(MetricBLEU): ...
Prepare
__init__.pyto specify classes to be loaded.from .new import MetricNewThen, load the modules with
--plugin_diroption with a path to the directory containing the above__init__.py.mbrs-decode \ --plugin_dir path/to/plugins/ \ hypotheses.txt \ --num_candidates 1024 \ --decoder mbr \ --metric my_bleu
mbrs-scorealso supports plug-in loading.mbrs-score \ --plugin_dir path/to/plugins/ \ hypotheses.txt \ -r references.txt \ --metric my_bleu