Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion megatron/core/models/gpt/gpt_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ def _postprocess(
if not self.post_process:
return hidden_states

if self.config.mtp_num_layers is not None:
if self.config.mtp_num_layers:
hidden_states = process_mtp_loss(
hidden_states=hidden_states,
labels=labels,
Expand Down
5 changes: 5 additions & 0 deletions megatron/core/optimizer/qk_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ def clip_qk(model, log_max_only=False) -> float:
for model_chunk in model:
for transformer_layer in model_chunk.module.module.decoder.layers:
if hasattr(transformer_layer.self_attention, 'clip_qk'):
if (
transformer_layer.self_attention.core_attention.current_max_attn_logits
is None
):
continue
torch.distributed.all_reduce(
transformer_layer.self_attention.core_attention.current_max_attn_logits,
op=torch.distributed.ReduceOp.MAX,
Expand Down
Loading