From 6dba2de02776ae16dcc2166b8cdcdc1673ae7d7e Mon Sep 17 00:00:00 2001 From: Jared Van Bortel Date: Thu, 28 Mar 2024 18:01:05 -0400 Subject: [PATCH] convert-hf : small fix for mypy --- convert-hf-to-gguf.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/convert-hf-to-gguf.py b/convert-hf-to-gguf.py index c1fe385f3..79084d21d 100755 --- a/convert-hf-to-gguf.py +++ b/convert-hf-to-gguf.py @@ -1085,12 +1085,14 @@ class LlamaModel(Model): if data_torch.dtype not in (torch.float16, torch.float32): data_torch = data_torch.to(torch.float32) - if name.endswith(("q_proj.weight")): - data_torch = permute(data_torch, n_head, n_head) - if name.endswith(("k_proj.weight")): - data_torch = permute(data_torch, n_head, n_kv_head) + data = data_torch.numpy() - data = data_torch.squeeze().numpy() + if name.endswith("q_proj.weight"): + data = permute(data, n_head, n_head) + if name.endswith("k_proj.weight"): + data = permute(data, n_head, n_kv_head) + + data = data.squeeze() # map tensor names new_name = tensor_map.get_name(name, try_suffixes=(".weight", ".bias"))