IO¶
torch_load_checkpoint¶
-
load_checkpoint
(file, **kwargs)[source]¶ Loads a saved model
Parameters: - file (str) – filepath to a file containing a saved model
- **kwargs – Additional keyword arguments (passed to torch.load) Especially “map_location” is important to change the device the state_dict should be loaded to
Returns: checkpoint state_dict
Return type: OrderedDict
torch_save_checkpoint¶
-
save_checkpoint
(file: str, model=None, optimizers={}, epoch=None, **kwargs)[source]¶ Save model’s parameters
Parameters: - file (str) – filepath the model should be saved to
- model (AbstractNetwork or None) – the model which should be saved if None: empty dict will be saved as state dict
- optimizers (dict) – dictionary containing all optimizers
- epoch (int) – current epoch (will also be pickled)