fix W_pack for-loop

This commit is contained in:
jameswu2014 2023-09-11 12:05:35 +08:00
parent 39c4b8540d
commit 306d71be42

View file

@ -232,7 +232,7 @@ for part_name in part_names:
model_part = torch.load(f"{dir_model}/{part_name}", map_location="cpu") model_part = torch.load(f"{dir_model}/{part_name}", map_location="cpu")
tmp=model_part tmp=model_part
for i in itertools.count(): for i in range(block_count):
if f"model.layers.{i}.self_attn.W_pack.weight" in model_part: if f"model.layers.{i}.self_attn.W_pack.weight" in model_part:
print(f"Unpacking and permuting layer {i}") print(f"Unpacking and permuting layer {i}")
tmp[f"model.layers.{i}.self_attn.q_proj.weight"]=reverse_hf_permute_part(model_part[f"model.layers.{i}.self_attn.W_pack.weight"],0,head_count,head_count) tmp[f"model.layers.{i}.self_attn.q_proj.weight"]=reverse_hf_permute_part(model_part[f"model.layers.{i}.self_attn.W_pack.weight"],0,head_count,head_count)