Skip to content
Closed
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
10 changes: 10 additions & 0 deletions src/mcore_bridge/model/gpts/qwen4_exp.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,16 @@ def _qsa_select_mask(self, hidden_states, attn_kwargs):
'back to full attention -- training will differ from sparse inference beyond the '
'indexer budget.')
return None
if getattr(self.config, 'sequence_parallel', False) and self.config.tensor_model_parallel_size > 1:
# Under SP the indexer would see SP-sharded hidden states (s/tp) while TE core
# attention runs on the all-gathered full sequence, so the [b, 1, s, s] selection
# mask would not match the q/k length (logical_or shape error in the unfused path).
self._warn_qsa_fallback_once(
'sequence_parallel is enabled: the QSA indexer consumes SP-sharded hidden states '
'while core attention runs on the full sequence. QSA layers fall back to full '
'attention -- training will differ from sparse inference beyond the indexer '
'budget.')
return None
rotary_pos_emb = attn_kwargs.get('rotary_pos_emb')
if rotary_pos_emb is None:
return None
Expand Down