cayleypy.models.save_checkpoint

cayleypy.models.save_checkpoint(path: str | PathLike, model: Module, config: ModelConfig, graph_def: CayleyGraphDef | None = None) → ModelConfig[source]

Saves weights of a model together with the config describing this model.

Unlike a bare state dict, such checkpoint is self-describing: load_checkpoint() recreates the model from it without knowing the architecture in advance.

Parameters:
  • path – Path to the file to write.

  • model – Model whose weights to save.

  • config – Config describing model.

  • graph_def – Definition of the graph this model was trained for (optional). If given, hash of this definition is stored in the checkpoint, and load_checkpoint() will check it.

Returns:

Config stored in the checkpoint (it differs from config when graph_def is given).