hookeai.model_architectures.hybrid_base_model.predict.prediction.load_model_state

load_model_state(model, model_load_state=None, is_remove_posterior=True)[source]

Load model state from file.

Model state file is stored in model_directory under the name < model_name >.pt or < model_name >-< epoch >.pt if epoch is known.

Model state file corresponding to the best performance is stored in model_directory under the name < model_name >-best.pt or < model_name >-< epoch >-best.pt if epoch if known.

Model initial state file is stored in model directory under the name < model_name >-init.pt

Parameters:
  • model (torch.nn.Module) – Model.

  • model_load_state ({'default', 'init', int, 'best', 'last'},) –

    default=’default’ Available model state to be loaded from the model directory. Options:

    ’default’ : Model default state file

    ’init’ : Model initial state

    int : Model state of given training epoch

    ’best’ : Model state of best performance

    ’last’ : Model state of latest training epoch

  • is_remove_posterior (bool, default=True) – Remove model state files corresponding to training epochs posterior to the loaded state file. Effective only if loaded training epoch is known.

Returns:

epoch – Loaded model state training epoch. Defaults to None if training epoch is unknown.

Return type:

int