Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading