Bugfix for whisper quantization due to fake k_proj bias (#12524)

Signed-off-by: mgoin <michael@neuralmagic.com>
This commit is contained in:
Michael Goin 2025-01-28 23:49:03 -05:00 committed by GitHub
parent 46fb056749
commit bd02164cf9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -743,7 +743,7 @@ def _create_fake_bias_for_k_proj(
So that the bias for k_proj in qkv_proj can be initialized with zeros.
"""
for name, weight in weights:
if ".self_attn.k_proj.weight" in name:
if name.endswith(".self_attn.k_proj.weight"):
bias = torch.zeros(weight.size(0))
bias_name = name.replace("weight", "bias")
yield from [(name, weight), (bias_name, bias)]