Delete examine_ckpt.py
Browse files- examine_ckpt.py +0 -25
examine_ckpt.py
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
import sys
|
2 |
-
import math
|
3 |
-
import torch
|
4 |
-
from collections import OrderedDict
|
5 |
-
import re
|
6 |
-
from safetensors.torch import load_file
|
7 |
-
|
8 |
-
if len(sys.argv) != 2:
|
9 |
-
print(f"Examines checkpoint keys")
|
10 |
-
print("Usage: python examine_ckpt.py in_file")
|
11 |
-
exit()
|
12 |
-
|
13 |
-
model_path = sys.argv[1]
|
14 |
-
|
15 |
-
print("Loading file...")
|
16 |
-
if model_path.lower().endswith('.safetensors'):
|
17 |
-
state_dict = load_file(model_path)
|
18 |
-
else:
|
19 |
-
state_dict = torch.load(model_path, map_location='cpu', weights_only=True)
|
20 |
-
|
21 |
-
for name, p in state_dict.items():
|
22 |
-
if p.numel() == 0:
|
23 |
-
print(name, p.dtype, p.shape)
|
24 |
-
else:
|
25 |
-
print(name, p.dtype, p.shape, float(p.min()), float(p.max()))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|