oa::ModelFile

A complete OA model file loaded in memory. `ModelFile` owns model configuration, named weights, persistent state, optimizer state, and training progress. `load()` and `save()` implement the native `.oam` wire format. External formats are imported by `oa::ModelTranslator`; they are not alternative representations of this type.

Public Methods

void oa::ModelFile::addState(const char * inName, oa::ScalarType inDtype, oa::Span<const oa::U64> inShape, const void * inData, oa::U64 inBytes)
void oa::ModelFile::addWeight(const char * inName, oa::ScalarType inDtype, oa::Span<const oa::U64> inShape, const void * inData, oa::U64 inBytes)
const ModelTensorEntry * oa::ModelFile::findState(const char * inName)
const ModelTensorEntry * oa::ModelFile::findWeight(const char * inName)
bool oa::ModelFile::hasOptimizer()
bool oa::ModelFile::hasState()
bool oa::ModelFile::hasWeights()
oa::Result<oa::QuantMatrix> oa::ModelFile::loadQuantMatrix(oa::Engine & inEngine, const char * inName)
oa::Result<ModelFile> oa::ModelFile::quantizeWeights(oa::Quantization inQuantization)
oa::Status oa::ModelFile::save(const oa::String & inPath)
const void * oa::ModelFile::statePtr(const char * inName)
void * oa::ModelFile::statePtr(const char * inName)
const void * oa::ModelFile::weightPtr(const char * inName)

Static Public Methods

static oa::Result<ModelFile> oa::ModelFile::load(const oa::String & inPath)

Public Data Members

adamMVectorfield
adamVVectorfield
archConfigVectorfield
configModelFileConfigfield
formatVersionoa::U32field
optimizerModelOptimizerStatefield
optimizerPresentoa::Boolfield
progressModelTrainingProgressfield
stateBlobVectorfield
stateIndexVectorfield
weightBlobVectorfield
weightIndexVectorfield

Public Method Documentation

void oa::ModelFile::addState( const char * inName, oa::ScalarType inDtype, oa::Span<const oa::U64> inShape, const void * inData, oa::U64 inBytes )
No public source comment is attached to this declaration.

Parameters

inName
const char *

inDtype
oa::ScalarType

inShape
oa::Span<const oa::U64>

inData
const void *

inBytes
oa::U64

Returns

void

The declared return value.

void oa::ModelFile::addWeight( const char * inName, oa::ScalarType inDtype, oa::Span<const oa::U64> inShape, const void * inData, oa::U64 inBytes )
No public source comment is attached to this declaration.

Parameters

inName
const char *

inDtype
oa::ScalarType

inShape
oa::Span<const oa::U64>

inData
const void *

inBytes
oa::U64

Returns

void

The declared return value.

const ModelTensorEntry * oa::ModelFile::findState( const char * inName )
No public source comment is attached to this declaration.

Parameters

inName
const char *

Returns

const ModelTensorEntry *

The declared return value.

const ModelTensorEntry * oa::ModelFile::findWeight( const char * inName )
No public source comment is attached to this declaration.

Parameters

inName
const char *

Returns

const ModelTensorEntry *

The declared return value.

bool oa::ModelFile::hasOptimizer()
No public source comment is attached to this declaration.

Returns

bool

The declared return value.

bool oa::ModelFile::hasState()
No public source comment is attached to this declaration.

Returns

bool

The declared return value.

bool oa::ModelFile::hasWeights()
No public source comment is attached to this declaration.

Returns

bool

The declared return value.

oa::Result<oa::QuantMatrix> oa::ModelFile::loadQuantMatrix( oa::Engine & inEngine, const char * inName )
upload one encoded weight as the same semantic value consumed by the fused vkDNN MatMulNt path. Dense entries fail closed.

Parameters

inEngine
oa::Engine &

inName
const char *

Returns

oa::Result<oa::QuantMatrix>

The declared return value.

oa::Result<ModelFile> oa::ModelFile::quantizeWeights( oa::Quantization inQuantization )
Produce a weight-only inference artifact. Dense Float32 tensors with rank >= 2 become native OA Q4/Q8 blocks; scalar/vector weights and all state remain dense. Optimizer state is deliberately removed.

Parameters

inQuantization
oa::Quantization

Returns

oa::Result<ModelFile>

The declared return value.

oa::Status oa::ModelFile::save( const oa::String & inPath )
No public source comment is attached to this declaration.

Parameters

inPath
const oa::String &

Returns

oa::Status

The declared return value.

const void * oa::ModelFile::statePtr( const char * inName )
No public source comment is attached to this declaration.

Parameters

inName
const char *

Returns

const void *

The declared return value.

void * oa::ModelFile::statePtr( const char * inName )
No public source comment is attached to this declaration.

Parameters

inName
const char *

Returns

void *

The declared return value.

const void * oa::ModelFile::weightPtr( const char * inName )
No public source comment is attached to this declaration.

Parameters

inName
const char *

Returns

const void *

The declared return value.

static oa::Result<ModelFile> oa::ModelFile::load( const oa::String & inPath )
No public source comment is attached to this declaration.

Parameters

inPath
const oa::String &

Returns

oa::Result<ModelFile>

The declared return value.