bob.ip.binseg.utils.checkpointer

Classes

Checkpointer(model[, optimizer, scheduler, path])

A simple pytorch checkpointer

class bob.ip.binseg.utils.checkpointer.Checkpointer(model, optimizer=None, scheduler=None, path='.')[source]

Bases: object

A simple pytorch checkpointer

Parameters
  • model (torch.nn.Module) – Network model, eventually loaded from a checkpointed file

  • optimizer (torch.optim, Optional) – Optimizer

  • scheduler (torch.optim, Optional) – Learning rate scheduler

  • path (str, Optional) – Directory where to save checkpoints.

save(name, **kwargs)[source]
load(f=None)[source]

Loads model, optimizer and scheduler from file

Parameters

f (str, Optional) – Name of a file (absolute or relative to self.path), that contains the checkpoint data to load into the model, and optionally into the optimizer and the scheduler. If not specified, loads data from current path.

has_checkpoint()[source]
last_checkpoint()[source]