kempnerforge.config.checkpoint¶
Checkpoint configuration.
Classes
Checkpointing settings. |
|
A bounded step range with a registered checkpoint strategy. |
- class kempnerforge.config.checkpoint.AsyncCheckpointMode[source]¶
Bases:
StrEnum- disabled = 'disabled'¶
- async_ = 'async'¶
- async_pinned = 'async_with_pinned_mem'¶
- __new__(value)¶
- class kempnerforge.config.checkpoint.DynamicCheckpointWindow[source]¶
Bases:
objectA bounded step range with a registered checkpoint strategy.
Inside
[start, stop]the strategy decides which steps to save, and every such step is exempt fromCheckpointConfig.keep_last_nretention. Outside the window the regularCheckpointConfig.intervalcadence applies."power2"(default) saves atstartand at everystart + 2^kwhile<= stop– tight at the start of the window, doubling thereafter. New strategies register via@registry.register_dyn_ckpt_strategy(name)and become selectable by settingstrategy.
- class kempnerforge.config.checkpoint.CheckpointConfig[source]¶
Bases:
objectCheckpointing settings.
- dyn_ckpt_window: DynamicCheckpointWindow | None = None¶
- async_mode: AsyncCheckpointMode = 'disabled'¶
- should_save(step)[source]¶
Whether to write a checkpoint at
step.Inside
dyn_ckpt_window: the registered strategy decides (default"power2"saves atstartand eachstart + 2^kwhile<= stop). Outside the window: everyintervalsteps. Dynamic milestones are exempt fromkeep_last_n(seeCheckpointManager._cleanup).
- is_dynamic_milestone(step)[source]¶
True if
stepis a milestone of the configureddyn_ckpt_window.CheckpointManager._cleanupexcludes these fromkeep_last_nso the dense early-window checkpoints survive a finite retention.
- __init__(dir='checkpoints', interval=1000, dyn_ckpt_window=None, async_mode=AsyncCheckpointMode.disabled, keep_last_n=3, load_path=None, export_dtype='bfloat16', exclude_from_loading=<factory>, ignore_freeze_mismatch=False)¶
- Parameters:
dir (str)
interval (int)
dyn_ckpt_window (DynamicCheckpointWindow | None)
async_mode (AsyncCheckpointMode)
keep_last_n (int)
load_path (str | None)
export_dtype (Literal['float32', 'bfloat16'])
ignore_freeze_mismatch (bool)
- Return type:
None