Skip to content

Commit

Permalink
fix(mha.py): fix evaluation argu key err (#370)
Browse files Browse the repository at this point in the history
  • Loading branch information
huangting4201 authored Nov 18, 2024
1 parent 330c03a commit aee457c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internlm/model/modules/mha.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def _training(self, x, **kwargs):

# self attention
kwargs = _convert_cu_seqlens_for_qksplited(kwargs)
if gpc.config.data.use_packed_dataset is False:
if gpc.config.data.use_packed_dataset is False or self.training is False:
kwargs.pop("max_seqlen_q", None)
kwargs.pop("max_seqlen_k", None)
context = self.inner_attn(q, k, v, **kwargs)
Expand Down Expand Up @@ -529,7 +529,7 @@ def _training(self, x, **kwargs):

kv = torch.concat([k.unsqueeze(2), v.unsqueeze(2)], dim=2)

if gpc.config.data.use_packed_dataset is False:
if gpc.config.data.use_packed_dataset is False or self.training is False:
kwargs.pop("max_seqlen_q", None)
kwargs.pop("max_seqlen_k", None)

Expand Down

0 comments on commit aee457c

Please sign in to comment.