Types#

class pfl.common_types.Population(value)#

Enum representing the different pools the devices are divided up into.

class pfl.common_types.Checkpointer#

Mediator object for saving checkpoints. Creator decides the path to save to, caller decides when to save.

class pfl.common_types.LocalDiskCheckpointer(dir_path)#
class pfl.common_types.Saveable#

Interface to allow save and load the state of an object to/from disk.

This is useful to e.g. add fault tolerance to your components if you want to be able to resume training after a crash.

abstract save(dir_path)#

Save state of object to disk. Should be able to interpret saved state as a checkpoint that can be restored with load.

Parameters:

dir_path (str) – Directory on disk to store state.

Return type:

None

abstract load(dir_path)#

Load checkpoint from disk, which is the state previously saved with save.

Parameters:

dir_path (str) – Path to root directory where checkpoint can be loaded from. Should be same path as used with save.

Return type:

None

set_checkpointer(checkpointer)#

Can optionally be implemented to let the component invoke a call of save to save intermediate checkpoints on-demand instead of only during scheduled calls by other components, usually “after central iteration” by callbacks.

Parameters:

checkpointer (Checkpointer) – Can be called to invoke a save call on-demand.

Return type:

None