Chapter 56

stub/grouping

github.com/openfluke/welvet/stub/grouping🚧


Why it exists

Detect layer archetypes from safetensor-style names before mounting.

What it is

GroupRelatedTensors, DetectMHA/DetectSwiGLU/DetectRMSNorm → ArchetypeHint.

Go example

examples/56-stub-grouping/main.go

Run:cd welvet/examples/56-stub-grouping && source ../env.sh && go run .
package main

import (
	"fmt"

	"github.com/openfluke/welvet/stub/grouping"
)

func main() {
	tensors := []grouping.DetectedTensor{
		{Name: "model.layers.0.self_attn.q_proj.weight"},
		{Name: "model.layers.0.self_attn.k_proj.weight"},
		{Name: "model.layers.0.self_attn.v_proj.weight"},
		{Name: "model.layers.0.self_attn.o_proj.weight"},
	}
	ok, hint := grouping.DetectMHA("block0", tensors, 64, 4)
	fmt.Println(ok, hint)
}

Output

Run python3 _gen_welvet_book.py --run to capture output.