Skip to content

Commit 9b3f18b

Browse files
committed
Fix clip_qk for virtual pipeline size > 1
1 parent 9885ddb commit 9b3f18b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

megatron/core/optimizer/qk_clip.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ def clip_qk(model, log_max_only=False) -> float:
2222
for model_chunk in model:
2323
for transformer_layer in model_chunk.module.module.decoder.layers:
2424
if hasattr(transformer_layer.self_attention, 'clip_qk'):
25+
if transformer_layer.self_attention.core_attention.current_max_attn_logits is None:
26+
continue
2527
torch.distributed.all_reduce(
2628
transformer_layer.self_attention.core_attention.current_max_attn_logits,
2729
op=torch.distributed.ReduceOp.MAX,

0 commit comments

Comments
 (0)