rxn.onmt_models.training_files.ModelFiles
- class rxn.onmt_models.training_files.ModelFiles(model_dir)[source]
- Bases: - object- Class to make it easy to get the names/paths of the trained OpenNMT models. - Parameters
- model_dir ( - Union[- str,- PathLike]) –
 - Methods - __init__(model_dir)- param model_dir
 - Get the checkpoints contained in the directory, sorted by step number. - Get the last checkpoint matching the naming including the step number. - Get the next available config file name. - Attributes - MODEL_PREFIX- MODEL_STEP_PATTERN- ONMT_CONFIG_FILE- Absolute path to the model prefix; during training, OpenNMT will append "_step_10000.pt" to it (or other step numbers). - get_checkpoints()[source]
- Get the checkpoints contained in the directory, sorted by step number. - Return type
- List[- Path]
 
 - get_last_checkpoint()[source]
- Get the last checkpoint matching the naming including the step number. - Raises
- RuntimeError – no model is found in the expected directory. 
- Return type
- Path
 
 - property model_prefix: Path
- Absolute path to the model prefix; during training, OpenNMT will append “_step_10000.pt” to it (or other step numbers). - Return type
- Path