Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/benchmarks-mv/blob/main/evidence/q36-step-model-20261031/scripts/header-bytes.sh # benchmarks-mv Measurement harnesses and evidence bundles for AIEN on the NVIDIA DGX Spark GB10. Speed is reported against the machine's physical limit and my own previous run. Attachment of AienOS. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `benchmarks-mv / evidence / q36-step-model-20261031 / scripts / header-bytes.sh` 48 lines ยท 3194 bytes Raw Blame History 1 #!/usr/bin/env bash 2 # Weight bytes per launch class of the Qwen3.6-35B-A3B FP8 checkpoint, read from the safetensors headers only 3 # (data_offsets end - start per tensor; no tensor data is read, no model is loaded). Layers 0-39 and lm_head; 4 # the MTP file (mtp.safetensors) is excluded. Classes follow the lever-2 stamp kinds of the stroke timeline: 5 # expert one routed expert: experts.0.{gate,up,down}_proj.weight + .weight_scale_inv (every routed expert has the same shapes) 6 # shared the shared expert: shared_expert.{gate,up,down}_proj.weight + .weight_scale_inv 7 # gate_up the gate+up part of one routed expert, down the down part 8 # mix linear_attn.in_proj_{qkv,z} and self_attn.{q,k,v}_proj, FP8 weight + scale 9 # o_proj linear_attn.out_proj and self_attn.o_proj, FP8 weight + scale 10 # ab linear_attn.in_proj_{a,b} (bf16) 11 # router mlp.gate.weight (bf16 256 x 2048) 12 # lm_head lm_head.weight (bf16, outside.safetensors) 13 # Per-layer classes are summed over layers 0-39. Every value is an integer byte count read from a header. 14 # usage: header-bytes.sh CHECKPOINT_DIR > derived/header-bytes.json 15 set -eu 16 dir=$1 17 hdr() { # print the JSON header of a safetensors file 18 local n 19 n=$(od -An -t u8 -N8 "$1" | tr -d ' ') 20 tail -c +9 "$1" | head -c "$n" 21 } 22 tmp=$(mktemp -d) 23 trap 'rm -rf "$tmp"' EXIT 24 for l in $(seq 0 39); do hdr "$dir/layers-$l.safetensors" > "$tmp/l$l.json"; done 25 hdr "$dir/outside.safetensors" > "$tmp/outside.json" 26 shas=$(for f in "$tmp"/l*.json "$tmp"/outside.json; do printf '%s %s\n' "$(basename "$f")" "$(sha256sum < "$f" | cut -c1-64)"; done \ 27 | jq -R -s -c 'split("\n") | map(select(length > 0) | split(" ") | {(.[0]): .[1]}) | add') 28 jq -s -c --argjson shas "$shas" --arg config_sha "$(sha256sum < "$dir/config.json" | cut -c1-64)" ' 29 def sz($h; $re): [$h | to_entries[] | select(.key != "__metadata__") | select(.key | test($re)) 30 | .value.data_offsets[1] - .value.data_offsets[0]] | add // 0; 31 def per_layer($re): [.[0:40][] as $h | sz($h; $re)] | add; 32 { 33 source: "safetensors headers of layers-0..39.safetensors and outside.safetensors; mtp.safetensors excluded", 34 config_sha256: $config_sha, 35 header_sha256: $shas, 36 layers: 40, 37 expert_per_layer_first: sz(.[0]; "\\.mlp\\.experts\\.0\\.(gate|up|down)_proj\\.weight"), 38 expert: (per_layer("\\.mlp\\.experts\\.0\\.(gate|up|down)_proj\\.weight") / 40), 39 gate_up: (per_layer("\\.mlp\\.experts\\.0\\.(gate|up)_proj\\.weight") / 40), 40 down: (per_layer("\\.mlp\\.experts\\.0\\.down_proj\\.weight") / 40), 41 shared: (per_layer("\\.mlp\\.shared_expert\\.(gate|up|down)_proj\\.weight") / 40), 42 routed_expert_tensor_sets_layer0: ([.[0] | keys[] | select(test("\\.mlp\\.experts\\.[0-9]+\\.down_proj\\.weight$"))] | length), 43 mix: per_layer("\\.(linear_attn\\.in_proj_(qkv|z)|self_attn\\.(q|k|v)_proj)\\.weight"), 44 o_proj: per_layer("\\.(linear_attn\\.out_proj|self_attn\\.o_proj)\\.weight"), 45 ab: per_layer("\\.linear_attn\\.in_proj_(a|b)\\.weight$"), 46 router: per_layer("\\.mlp\\.gate\\.weight$"), 47 lm_head: sz(.[40]; "^lm_head\\.weight$") 48 }' $(for l in $(seq 0 39); do printf '%s ' "$tmp/l$l.json"; done) "$tmp/outside.json"