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
1 change: 1 addition & 0 deletions src/mcore_bridge/patcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ def forward(
input_ids=input_ids,
position_ids=position_ids,
embedding=embedding,
packed_seq_params=packed_seq_params,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The addition of packed_seq_params to the _get_embeddings call is correct and necessary for MTP to properly handle sequence packing (THD format). This ensures that the internal roll_tensor call correctly handles sequence boundaries.

Critical Issue: Note that this patched forward method returns a 3-tuple (hidden_states, input_ids, position_ids) at line 470. However, the caller in GPTModel._postprocess (at src/mcore_bridge/model/gpt_model.py:398) expects a single return value: hidden_states = self.mtp(...). This mismatch will cause a TypeError or ValueError in subsequent operations (like torch.chunk at line 413 of gpt_model.py) because hidden_states will be a tuple instead of a tensor.

Since the caller handles its own label/mask shifting and logging, you should consider updating the return statement at line 470 to only return hidden_states to maintain compatibility with the standard Megatron-Core API and the existing caller logic.

hidden_states=hidden_states,
)
assert not self.transformer_layer.self_attention.config.apply_rope_fusion
Expand Down
Loading