sliedes
(Sami Liedes)
May 18, 2021, 10:11pm
1
I’m trying to generate outputs with multiple beam widths for evaluation. For that, I’m trying to override beam_width on the command line. Is that possible? What I’ve tried so far:
$ onmt-main --config ../from-esv-2sim.yaml --checkpoint_path model/avg/ckpt-76000 --auto_config infer --beam_width 4 --features_file src1 src2 src3
onmt-main: error: unrecognized arguments: --beam_width 4
$ onmt-main --beam_width 4 --config ../from-esv-2sim.yaml --checkpoint_path model/avg/ckpt-76000 --auto_config infer --features_file src1 src2 src3
onmt-main: error: argument run_type: invalid choice: '4' (choose from 'train', 'eval', 'infer', 'export', 'score', 'average_checkpoints', 'update_vocab')
No, it is not possible. All hyperparameters should be defined in the configuration file.
Alternatively you could easily build around the high-level Runner
class. See this example:
"""This example demonstrates how to train a standard Transformer model in a few
lines of code using OpenNMT-tf high-level APIs.
"""
import argparse
import logging
import tensorflow as tf
import opennmt as onmt
tf.get_logger().setLevel(logging.INFO)
def main():
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter
)
parser.add_argument("run", choices=["train", "translate"], help="Run type.")
parser.add_argument("--src", required=True, help="Path to the source file.")
parser.add_argument("--tgt", help="Path to the target file.")
This file has been truncated. show original