Skip to content

set tensor names on block params (so weights aren't unnamed leaf_N)#1622

Merged
leejet merged 2 commits into
leejet:masterfrom
CloudhandsAI:cloudhands/name-block-params
Jun 8, 2026
Merged

set tensor names on block params (so weights aren't unnamed leaf_N)#1622
leejet merged 2 commits into
leejet:masterfrom
CloudhandsAI:cloudhands/name-block-params

Conversation

@RapidMark

Copy link
Copy Markdown
Contributor

GGMLBlock::get_param_tensors already builds each weight's full hierarchical name (e.g. double_blocks.0.img_attn.qkv.weight) but only uses it as the map key — the ggml tensor's own name is never set, so in the compute graph the weight tensors are unnamed and ggml auto-assigns leaf_N.

That makes a couple of things harder than they need to be:

  • Graph dumps / profiling show leaf_N instead of the layer name, so you can't tell which weight a node belongs to.
  • Tooling that inspects weights by name can't — e.g. importance-matrix / quantization calibration that keys per-weight statistics by the weight name.

The fix is one line, where the full name is already in hand:

for (auto& pair : params) {
    ggml_tensor* param           = pair.second;
    tensors[prefix + pair.first] = pair.second;
    ggml_set_name(param, (prefix + pair.first).c_str());   // added
}

Pure metadata — ggml_set_name only sets the tensor's name field, so there's no change to data, shapes, or the compute graph; generation output is unchanged. Names are bounded by GGML_MAX_NAME as elsewhere. All blocks route their leaf params through this base method, so every weight gets named.

Tested: clean Vulkan build; a Flux (Krea Q4) generation runs and produces a normal image.

Mark Caldwell and others added 2 commits June 8, 2026 07:18
GGMLBlock::get_param_tensors builds each param's full hierarchical name but
only uses it as the map key; the tensor's own name is never set, so weights
appear as unnamed "leaf_N" in graph dumps, profiling, and to any tooling that
inspects weights by name. Set the name where it's already constructed.
@leejet leejet merged commit 19bdfe2 into leejet:master Jun 8, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants