def get_nmt_model_path(nmt_model_selector, nmt_config):
"""Get the path to the NMT model according the given NMT config.
This switches between the most recent checkpoint, the best BLEU
checkpoint, or the latest parameters (params.npz). This method
delegates to ``get_nmt_model_path_*``. This
method relies on the global ``args`` variable.
Args:
nmt_model_selector (string): the ``--nmt_model_selector`` arg
which defines the policy to decide
which NMT model to load (params,
bleu, or time)
nmt_config (dict): NMT configuration, see ``get_nmt_config()``
Returns:
string. Path to the NMT model file
"""
if nmt_model_selector == 'params':
return get_nmt_model_path_params(nmt_config)
elif nmt_model_selector == 'bleu':
return get_nmt_model_path_best_bleu(nmt_config)
elif nmt_model_selector == 'time':
return get_nmt_model_path_most_recent(nmt_config)
logging.fatal("NMT model selector %s not available. Please double-check "
"the --nmt_model_selector parameter." % nmt_model_selector)
评论列表
文章目录