scdori.load_best_model

scdori.load_best_model#

scdori.load_best_model(model, best_model_path, device)#

Load the best model weights from disk into the given model.

Parameters:
  • model (torch.nn.Module) – The model instance to which the weights will be loaded.

  • best_model_path (str or Path) – Path to the file containing the best model weights.

  • device (torch.device) – The device (CPU or CUDA) where the model will be moved.

Returns:

torch.nn.Module The same model, now loaded with weights and set to eval mode.

Raises:

FileNotFoundError – If the specified best_model_path does not exist.