Skip to content

Commit 71807bc

Browse files
Yejing-Laihwchen2017loadams
authored
Fix fused_qkv print model ValueError (#7109)
Suppose qkv_linear_weight_shape = [in_features, out_features]. The qkv linear weight shape is [3, in_features, out_features] if using fued_qkv gemm optimization. It will cause "ValueError: too many values to unpack (expected 2)" issue when printing the model. Solution: Take the last two weight dimensions shapes as in_features and out_features. Signed-off-by: Lai, Yejing <[email protected]> Co-authored-by: Hongwei Chen <[email protected]> Co-authored-by: Logan Adams <[email protected]>
1 parent 17c6595 commit 71807bc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

deepspeed/module_inject/layers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ def __deepcopy__(self, memo):
229229

230230
def extra_repr(self):
231231
if self.weight is not None:
232-
out_features, in_features = self.weight.shape if self.weight is not None else (None, None)
232+
out_features, in_features = self.weight.shape[-2:] if self.weight is not None else (None, None)
233233
dtype = self.weight.dtype if self.weight is not None else None
234234
extra_repr_str = "in_features={}, out_features={}, bias={}, dtype={}".format(
235235
in_features, out_features, self.bias is not None, dtype)

0 commit comments

Comments
 (0)