Skip to content

Commit 422134f

Browse files
authored
Merge branch 'huggingface:main' into varlen
2 parents b792875 + bb51139 commit 422134f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

optimum/exporters/ipex/modeling_utils.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -662,9 +662,9 @@ def __init__(self, module, config) -> None:
662662
if use_bias:
663663
concat_bias = torch.concat(bias_list, 0).contiguous()
664664
self.concat_linear.bias = nn.Parameter(concat_bias)
665-
self.q_slice = self.q_proj.out_features
666-
self.k_slice = self.q_slice + self.k_proj.out_features
667-
self.v_slice = self.k_slice + self.v_proj.out_features
665+
self.q_slice = self.q_proj.weight.shape[0]
666+
self.k_slice = self.q_slice + self.k_proj.weight.shape[0]
667+
self.v_slice = self.k_slice + self.v_proj.weight.shape[0]
668668
if self.module_device.type == "cpu":
669669
if module.o_proj.__class__.__name__ not in ["LinearAllreduce"]:
670670
self.mha_linear_add = LinearAdd(module.o_proj)

0 commit comments

Comments
 (0)