find hc keys

This commit is contained in:
2026-05-31 21:38:43 +00:00
parent 52b4971711
commit c54dd15550

View File

@@ -1,37 +1,34 @@
#!/usr/bin/env python3
"""Dump checkpoint key names for layers 0, 2, 60 — non-expert only."""
"""Find hc-related and global keys in the checkpoint."""
import json
from pathlib import Path
CHECKPOINT_DIR = "/root/nvidia-meeting/DeepSeek-V4-Pro"
CHECKPOINT_DIR = "/root/nvidia-meeting/DeepSeek-V4-Pro-NVFP4"
cdir = Path(CHECKPOINT_DIR)
idx = cdir / "model.safetensors.index.json"
with open(idx) as f:
wmap = json.load(f).get("weight_map", {})
def main():
cdir = Path(CHECKPOINT_DIR)
index_path = cdir / "model.safetensors.index.json"
with open(index_path) as f:
weight_map = json.load(f).get("weight_map", {})
for li in [0, 1, 2, 3, 59, 60]:
prefix = f"layers.{li}."
keys = sorted(k for k in weight_map if k.startswith(prefix))
filtered = [k for k in keys if '.experts.' not in k]
print(f"\n=== Layer {li} non-expert keys ({len(filtered)}) ===")
for k in filtered:
print(f" {k}")
# Also: shared_experts, hc, and mhc keys for layer 0
prefix0 = "layers.0."
keys0 = sorted(k for k in weight_map if k.startswith(prefix0))
se_keys = [k for k in keys0 if 'shared_expert' in k or 'hc' in k or 'ffn_norm' in k]
print(f"\n=== Layer 0 shared_expert + hc + ffn_norm keys ===")
for k in se_keys:
print(f" {k}")
# Non-layer global keys
other = sorted(k for k in weight_map if not k.startswith("layers."))
print(f"\n=== Global keys ===")
for k in other:
print(f" {k}")
# Find all keys containing 'hc' or global (non-layers.) keys
hc_keys = sorted(k for k in wmap if 'hc' in k.lower())
print(f"HC keys ({len(hc_keys)}):")
for k in hc_keys[:20]:
print(f" {k}")
if len(hc_keys) > 20:
print(f" ... and {len(hc_keys)-20} more")
if __name__ == "__main__":
main()
# Global keys (not starting with 'layers.')
global_keys = sorted(k for k in wmap if not k.startswith('layers.'))
print(f"\nGlobal keys ({len(global_keys)}):")
for k in global_keys:
print(f" {k}")
# Check: are there keys with 'hyper' or 'connection' in them?
hyper_keys = sorted(k for k in wmap if 'hyper' in k.lower() or 'connection' in k.lower())
print(f"\nHyper/connection keys ({len(hyper_keys)}):")
for k in hyper_keys[:10]:
print(f" {k}")
# Check layer 0 non-expert keys that contain 'hc' or 'hyper'
l0_hc = sorted(k for k in wmap if k.startswith('layers.0.') and ('hc' in k.lower() or 'hyper' in k.lower()))
print(f"\nLayer 0 hc/hyper keys: {l0_hc}")