[BugFix] gemma loading weights "lm_head.weight" key error (#577)

This commit is contained in:
Daniel Hernandez Garcia
2024-07-02 06:10:07 +01:00
committed by GitHub
parent d9ac639202
commit 95dc093b19

View File

@@ -310,6 +310,10 @@ class GemmaForCausalLM(nn.Module):
weight_loader(param, loaded_weight, shard_id)
break
else:
# lm_head is not used in vllm as it is tied with embed_token.
# To prevent errors, skip loading lm_head.weight.
if "lm_head.weight" in name:
continue
# Skip loading extra bias for GPTQ models.
if name.endswith(".bias") and name not in params_dict:
continue