[FP8 KV Cache] Avoid KeyError at loading pre-quantized FP8 model with kv_scale (#1559)

This commit is contained in:
HAI
2024-10-03 01:52:26 -07:00
committed by GitHub
parent e6852b0dd2
commit e0b5dbcec1

View File

@@ -400,6 +400,9 @@ class LlamaForCausalLM(nn.Module):
# Skip loading extra bias for GPTQ models.
if name.endswith(".bias") and name not in params_dict:
continue
# Skip loading kv_scale from ckpts towards new design.
if name.endswith(".kv_scale") and name not in params_dict:
continue
param = params_dict[name]
weight_loader = getattr(param, "weight_loader", default_weight_loader)
weight_loader(param, loaded_weight)