Skip to main content

ClikaRT::io::SubsetSpec

struct

Header: ClikaRT/io/tensors_container.h

Which entries TensorsContainer::subset takes, and under which names the sub-container serves them.

Types​

enum Match​

enum class Match : std::uint8_t

EnumeratorDescription
Prefixtext is a name prefix ("model.layers.3."): an entry is taken when its name starts with it. With strip the prefix is removed from the name the sub-container serves ("self_attn.q_proj.weight").
Patterntext is a regular expression (RE2 syntax) matched against the WHOLE name. With strip the name the sub-container serves is the pattern's first capture group ("model\\.layers\\.3\\.(.*)"), so the pattern must declare one; without strip the full name is kept, the pattern only selecting.

Declared in ClikaRT/io/tensors_container.h, line 60

Data members​

match​

how text selects entries

Declared in ClikaRT/io/tensors_container.h, line 72

text​

std::string text

the prefix, or the pattern

Declared in ClikaRT/io/tensors_container.h, line 73

strip​

bool strip = true

shorten the served names (above)

Declared in ClikaRT/io/tensors_container.h, line 74

return_clone​

bool return_clone = false

false (the default): the taken entries MOVE out of the container into the sub-container, one owner per name, so the container's names() no longer lists them and a second subset of the same names is empty. true: the sub-container shares the entries and the container keeps serving them too, for a weight two modules bind (a tied embedding and head). Either way no tensor data is read or copied, and a weight read through both containers is one tensor.

Declared in ClikaRT/io/tensors_container.h, line 82