Skip to main content

ClikaRT::nn::LoadOptions

struct

Header: ClikaRT/nn/module.h

Options for the load_state_dict overloads (a plain aggregate; assign the fields you need). The same options serve BOTH load paths (an in-memory NamedTensors dict and a lazy checkpoint container), so a model accounts its weight names identically whichever way it loads. strict gates the completeness report; the allow-lists carve per-name exceptions out of it without turning the whole check off:

  • allow_missing: declared slot names the checkpoint may legitimately omit, e.g. a tied head's lm_head.weight, absent from checkpoints that share it with the embedding and bound by weight-sharing instead.
  • allow_unexpected: checkpoint names no slot declares that are fine to leave unread, e.g. a checkpoint shipping a redundant copy of a tied head's weight.
  • weight_residency: a load-scope residency override. When set, every module in the tree that admits a residency choice adopts this value before the checkpoint binds, as if it had been constructed with it, so one load call pins the whole model's posture without touching the model's own construction defaults. A module whose class pins its residency keeps the pin; the load logs one summary line with how many modules adopted the override and how many kept a class-pinned residency (Linear::residency() reports any one module's outcome precisely). Packed on a weight whose layout cannot pack still refuses readably at bind, exactly as a constructed Packed does. Absent (the default) changes nothing.

Data members

strict

bool strict = true

Reject any missing/unexpected checkpoint key (the default). false binds what matches and ignores the rest.

Declared in ClikaRT/nn/module.h, line 111

allow_missing

std::vector<std::string> allow_missing

Key patterns excused from the missing-key check while strict holds.

Declared in ClikaRT/nn/module.h, line 114

allow_unexpected

std::vector<std::string> allow_unexpected

Key patterns excused from the unexpected-key check while strict holds.

Declared in ClikaRT/nn/module.h, line 117

weight_residency

std::optional<WeightResidency> weight_residency

Overrides every residency-choosing module's posture for this load (see WeightResidency); absent changes nothing.

Declared in ClikaRT/nn/module.h, line 120