oa::CheckpointManager

CheckpointManager class in the OA Ml public surface.

Public Methods

oa::F64 oa::CheckpointManager::bestMetric()
oa::String oa::CheckpointManager::incrementalDir()
bool oa::CheckpointManager::isBetter(oa::F64 inMetric)
oa::Status oa::CheckpointManager::loadBestInto(oa::Module & inOutModel, oa::Optimizer & inOutOpt)
oa::Status oa::CheckpointManager::loadLatestInto(oa::Module & inOutModel, oa::Optimizer & inOutOpt)
oa::String oa::CheckpointManager::masterPath()
oa::Status oa::CheckpointManager::maybeSave(oa::Module & inModel, oa::Optimizer & inOpt, oa::U64 inStep, oa::F64 inMetric, bool inForce = false)
const oa::String & oa::CheckpointManager::metricName()
oa::String oa::CheckpointManager::modelDir()
oa::Status oa::CheckpointManager::saveIncremental(oa::Module & inModel, oa::Optimizer & inOpt, oa::U64 inStep, oa::F64 inMetric, const oa::String & inMetricName = = {})

Constructor & Destructor Documentation

oa::CheckpointManager::CheckpointManager( oa::Engine & inEngine, CheckpointManagerConfig inConfig = {} )
No public source comment is attached to this declaration.

Parameters

inEngine
oa::Engine &

inConfig
CheckpointManagerConfig

Default: {}

Public Method Documentation

oa::F64 oa::CheckpointManager::bestMetric()
No public source comment is attached to this declaration.

Returns

oa::F64

The declared return value.

oa::String oa::CheckpointManager::incrementalDir()
No public source comment is attached to this declaration.

Returns

oa::String

The declared return value.

bool oa::CheckpointManager::isBetter( oa::F64 inMetric )
No public source comment is attached to this declaration.

Parameters

inMetric
oa::F64

Returns

bool

The declared return value.

oa::Status oa::CheckpointManager::loadBestInto( oa::Module & inOutModel, oa::Optimizer & inOutOpt )
Restore weights and optimizer state into an already-constructed model/optimizer. Symmetric with maybeSave.

Parameters

inOutModel
oa::Module &

inOutOpt
oa::Optimizer &

Returns

oa::Status

The declared return value.

oa::Status oa::CheckpointManager::loadLatestInto( oa::Module & inOutModel, oa::Optimizer & inOutOpt )
No public source comment is attached to this declaration.

Parameters

inOutModel
oa::Module &

inOutOpt
oa::Optimizer &

Returns

oa::Status

The declared return value.

oa::String oa::CheckpointManager::masterPath()
No public source comment is attached to this declaration.

Returns

oa::String

The declared return value.

oa::Status oa::CheckpointManager::maybeSave( oa::Module & inModel, oa::Optimizer & inOpt, oa::U64 inStep, oa::F64 inMetric, bool inForce = false )
save model + optimizer state if the metric improved (or unconditionally if inForce=true). Saves weights AND optimizer state (AdamW M/V/step, etc.) into one .oam via Module::save(engine, path, opt).

Parameters

inModel
oa::Module &

inOpt
oa::Optimizer &

inStep
oa::U64

inMetric
oa::F64

inForce
bool

Default: false

Returns

oa::Status

The declared return value.

const oa::String & oa::CheckpointManager::metricName()
No public source comment is attached to this declaration.

Returns

const oa::String &

The declared return value.

oa::String oa::CheckpointManager::modelDir()
No public source comment is attached to this declaration.

Returns

oa::String

The declared return value.

oa::Status oa::CheckpointManager::saveIncremental( oa::Module & inModel, oa::Optimizer & inOpt, oa::U64 inStep, oa::F64 inMetric, const oa::String & inMetricName = = {} )
save a resumable incremental checkpoint without changing the best-model metric/master file. Used by mid-epoch saves: only a complete epoch metric (preferably validation) may select the best model.

Parameters

inModel
oa::Module &

inOpt
oa::Optimizer &

inStep
oa::U64

inMetric
oa::F64

inMetricName
const oa::String &

Default: = {}

Returns

oa::Status

The declared return value.