Welvet examples
56. stub/grouping
Part: VIII Β· Stubs
Package: github.com/openfluke/welvet/stub/grouping
Status: partial β π§
When
Scaffold / experimental stub stub/grouping (may be partial).
Where
import "github.com/openfluke/welvet/stub/grouping"
cd 56-stub-grouping && source ../env.sh && go run .
Why
Detect layer archetypes from safetensor-style names before mounting.
What
GroupRelatedTensors, DetectMHA/DetectSwiGLU/DetectRMSNorm β ArchetypeHint.
Sample output (captured)
true {MultiHeadAttention 64 4}
Live capture from go run ./cmd/runall on local ../../welvet (exit 0).
Source
Copied from the Welvet feature book examples (openfluke.github.io/welvet/examples/56-stub-grouping).
main.go
Download source β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)
}