Skip to content

Commit c1f2970

Browse files
HJSangclaude
andcommitted
test: compute_log_probs returns [seq, 1]
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 365e9db commit c1f2970

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎tests/fast/backends/training_utils/loss_hub/test_vocab_parallel_cross_entropy.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ def _check_compute_log_probs_without_megatron(rank: int, world_size: int, port:
9999
group = dist.new_group([0])
100100
logits = _full_logits(torch.float32)[:, 0]
101101
tokens = _target()[:, 0]
102-
expected = torch.log_softmax(logits, dim=-1).gather(-1, tokens.unsqueeze(-1)).squeeze(-1)
102+
# [seq, 1], the shape compute_log_probs has always returned
103+
expected = torch.log_softmax(logits, dim=-1).gather(-1, tokens.unsqueeze(-1))
103104

104105
torch.testing.assert_close(compute_log_probs(logits, tokens, group), expected, atol=1e-6, rtol=1e-6)
105106
finally:

0 commit comments

Comments
 (0)