nvalchemi.hooks.CheckpointableHook#

class nvalchemi.hooks.CheckpointableHook(*args, **kwargs)[source]#

Protocol for hooks that own restart-critical runtime state.

Most hooks should remain stateless and omit this protocol. Hooks that affect resumed training semantics can opt in by exposing state_dict and load_state_dict. Pydantic-backed hooks should use model_dump() inside their state_dict implementation for declarative fields and add only the extra runtime state they own.

load_state_dict(state)[source]#

Restore hook state from a training checkpoint.

Parameters:

state (Mapping[str, Any])

Return type:

None

state_dict()[source]#

Return hook state to store with a training checkpoint.

Return type:

Mapping[str, Any]