src.canns.analyzer.slow_points.checkpoint

Checkpoint utilities for saving and loading trained RNN models using BrainPy’s built-in checkpointing.

Functions

load_checkpoint(model, filepath)

Load model parameters from a checkpoint file using BrainPy checkpointing.

save_checkpoint(model, filepath)

Save model parameters to a checkpoint file using BrainPy checkpointing.

Module Contents

src.canns.analyzer.slow_points.checkpoint.load_checkpoint(model, filepath)[source]

Load model parameters from a checkpoint file using BrainPy checkpointing.

Parameters:
  • model (brainpy.DynamicalSystem) – BrainPy model to load parameters into.

  • filepath (str) – Path to the checkpoint file.

Returns:

True if checkpoint was loaded successfully, False otherwise.

Return type:

bool

Example

>>> from canns.analyzer.slow_points import load_checkpoint
>>> if load_checkpoint(rnn, "my_model.msgpack"):
...     print("Loaded successfully")
... else:
...     print("No checkpoint found")
Loaded checkpoint from: my_model.msgpack
Loaded successfully
src.canns.analyzer.slow_points.checkpoint.save_checkpoint(model, filepath)[source]

Save model parameters to a checkpoint file using BrainPy checkpointing.

Parameters:
  • model (brainpy.DynamicalSystem) – BrainPy model to save.

  • filepath (str) – Path to save the checkpoint file.

Example

>>> from canns.analyzer.slow_points import save_checkpoint
>>> save_checkpoint(rnn, "my_model.msgpack")
Saved checkpoint to: my_model.msgpack