-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_w4a8.py
More file actions
32 lines (27 loc) · 1 KB
/
Copy pathdebug_w4a8.py
File metadata and controls
32 lines (27 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# debug_layer17_load_fix.py
import json
from vllm.model_executor.model_loader.default_loader import DefaultModelLoader
from vllm.config import LoadConfig, ModelConfig
# Load the index
with open("./Llama-3.1-8B-Instruct-W4A8H100/model.safetensors.index.json") as f:
index = json.load(f)
layer17_keys = [k for k in index["weight_map"].keys() if "model.layers.17" in k]
print("Layer 17 keys in index:")
for k in layer17_keys:
print(" ", k)
# Setup loader and config
load_config = LoadConfig(
load_format="fastsafetensors", # or "safetensors"
download_dir="./Llama-3.1-8B-Instruct-W4A8H100",
use_tqdm_on_load=False
)
model_config = ModelConfig(
model="./Llama-3.1-8B-Instruct-W4A8H100",
quantization="w4a8"
)
loader = DefaultModelLoader(load_config)
# Iterate through all weights and print those in layer 17
print("\nTrying to load Layer 17 weights:")
for name, tensor in loader.get_all_weights(model_config, None):
if "layers.17" in name:
print("Loaded:", name, "->", tensor.shape)