Files
nvfp4-megamoe-kernel/dump_checkpoint_keys.py
2026-05-31 21:24:35 +00:00

27 lines
927 B
Python

#!/usr/bin/env python3
"""Dump checkpoint key names and shapes — attention and compressor keys only."""
import json
from pathlib import Path
CHECKPOINT_DIR = "/root/nvidia-meeting/DeepSeek-V4-Pro"
def main():
cdir = Path(CHECKPOINT_DIR)
index_path = cdir / "model.safetensors.index.json"
if index_path.exists():
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"model.layers.{li}."
keys = sorted(k for k in weight_map if k.startswith(prefix))
# Filter: show everything EXCEPT individual expert weights
filtered = [k for k in keys if '.experts.' not in k]
print(f"\n=== Layer {li} keys (non-expert) ===")
for k in filtered:
print(f" {k}")
else:
print("No index file found!")
if __name__ == "__main__":
main()