---
title: "ClikaRT::nn::LoadOptions"
sidebar_label: "LoadOptions"
description: "Options for the load_state_dict overloads (a plain aggregate; assign the fields you need)."
---

<!-- Generated by tools/doxygen2mdx from Doxygen XML. Do not edit. -->

<span class="api-kind api-kind--struct">struct</span>

**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`](../NamedTensors.md) dict and a lazy checkpoint container), so a model accounts its weight names identically whichever way it loads. [`strict`](./LoadOptions.md#strict) gates the completeness report; the allow-lists carve per-name exceptions out of it without turning the whole check off:

- [`allow_missing`](./LoadOptions.md#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`](./LoadOptions.md#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`](./LoadOptions.md#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, and so does a module whose weight is tied to another module's table; the load logs one summary line with how many modules adopted the override and how many kept their own residency. `Packed` on a weight whose layout cannot pack still refuses readably at bind. Absent (the default) changes nothing.
- [`pack_on_load`](./LoadOptions.md#pack_on_load): pack every bound weight during THIS load, so a serving process pays the one-time pack at load time instead of on its first forward. It is the same pack the first forward would run (once, thread-safe), driven through the tree's own pack hooks from the root, so a composite that fuses or folds at pack time does that work here too. The bind and the pack interleave per module: a module's own weights and its direct children's bind right before its pack hook runs, a weight a pack hook reads by name or enumerates binds at that read, and whatever no pack hook reached binds after the walk, so a load holds one module's raw weights beside its pack, never the whole model's. After it each packed weight has exactly one resident copy and still reads back through `named_parameters()` / `state_dict()`. Default off: the first forward packs.

## Data members

### strict {#strict}

<div class="api-signature">

`bool` **`strict`** `= true`

</div>

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

<div class="api-declared">

Declared in `ClikaRT/nn/module.h`, line 122

</div>

### allow\_missing {#allow_missing}

<div class="api-signature">

`std::vector<std::string>` **`allow_missing`**

</div>

Key patterns excused from the missing-key check while [`strict`](./LoadOptions.md#strict) holds.

<div class="api-declared">

Declared in `ClikaRT/nn/module.h`, line 125

</div>

### allow\_unexpected {#allow_unexpected}

<div class="api-signature">

`std::vector<std::string>` **`allow_unexpected`**

</div>

Key patterns excused from the unexpected-key check while [`strict`](./LoadOptions.md#strict) holds.

<div class="api-declared">

Declared in `ClikaRT/nn/module.h`, line 128

</div>

### weight\_residency {#weight_residency}

<div class="api-signature">

`std::optional<`[`WeightResidency`](./index.md#WeightResidency)`>` **`weight_residency`**

</div>

Overrides every residency-choosing module's posture for this load (see [`WeightResidency`](./index.md#WeightResidency)); absent changes nothing.

<div class="api-declared">

Declared in `ClikaRT/nn/module.h`, line 131

</div>

### pack\_on\_load {#pack_on_load}

<div class="api-signature">

`bool` **`pack_on_load`** `= false`

</div>

Pack every bound weight at the end of this load (the first forward's pack, paid now). Default off.

<div class="api-declared">

Declared in `ClikaRT/nn/module.h`, line 134

</div>
