change code to full string match and print necessary message

change code to full string match and print a short message to inform users that lm_head.weight has been skipped.
This commit is contained in:
Zheng.Deng 2024-04-17 02:10:12 +08:00
parent 0060ccdde6
commit 6d84a42d1e

View file

@ -2279,8 +2279,9 @@ class GemmaModel(Model):
for name, data_torch in self.get_tensors():
# lm_head is not used in llama.cpp, while autoawq will include this tensor in model
# To prevent errors, skip loading lm_head.weight.
if "lm_head.weight" in name:
continue
if name == "lm_head.weight":
print(f"Skipping get tensor {name!r} in safetensors so that convert can end normally.")
continue
old_dtype = data_torch.dtype