interplane.Get Omega
Read in your language

MojoLlama

Archived Mojo/MAX quantizer and serving research repository (read-only history)

Brought by drakestapleton

branch main Branches Tags History

MojoLlama / inspect_model.py

54 lines · 1527 bytes Raw Blame History
1#!/usr/bin/env python3
2import gguf
3import numpy as np
4import sys
5
6reader = gguf.GGUFReader('/tmp/models/qwen3.6-35b-a3b-q4_k_m.gguf')
7
8# List all tensor names for layer 0 only (fast iteration with break)
9count = 0
10for t in reader.tensors:
11 name = t.name
12 if name.startswith('blk.0.'):
13 print(f'{name}: shape={list(t.shape)} type={t.tensor_type}')
14 count += 1
15 if count >= 20:
16 break
17
18print()
19
20# Check ssm_a values
21for t in reader.tensors:
22 if t.name == 'blk.0.ssm_a':
23 data = gguf.dequantize(t.data, t.tensor_type).astype(np.float32).reshape(-1)
24 print(f'SSM_A: {data}')
25 print(f' shape: {data.shape}')
26 print(f' exp(-exp(A)): {np.exp(-np.exp(data))}')
27 break
28
29# Check ssm_dt.bias
30for t in reader.tensors:
31 if t.name == 'blk.0.ssm_dt.bias':
32 data = gguf.dequantize(t.data, t.tensor_type).astype(np.float32).reshape(-1)
33 print(f'ssm_dt.bias: {data}')
34 print(f' shape: {data.shape}')
35 break
36
37# Check ssm_norm.weight
38for t in reader.tensors:
39 if t.name == 'blk.0.ssm_norm.weight':
40 data = gguf.dequantize(t.data, t.tensor_type).astype(np.float32).reshape(-1)
41 print(f'ssm_norm.weight: {data}')
42 print(f' shape: {data.shape}')
43 break
44
45# Check layer 3 (attention layer) tensors
46print()
47count = 0
48for t in reader.tensors:
49 name = t.name
50 if name.startswith('blk.3.'):
51 print(f'L3 {name}: shape={list(t.shape)} type={t.tensor_type}')
52 count += 1
53 if count >= 20:
54 break