All-gather local logits along the vocab dimension to reconstruct [H, V_global].
(
logits: torch.Tensor, # [H, V_local]
)
| 75 | H, V = probs.shape # noqa: N806 |
| 76 | q = torch.empty(num_samples, H, V, device=probs.device, dtype=probs.dtype) |
| 77 | q.exponential_() |
| 78 | return probs.unsqueeze(0).div(q).argmax(dim=-1).T # [H, num_samples] |
| 79 | |
| 80 | |
| 81 | def _allgather_logits( |
| 82 | logits: torch.Tensor, # [H, V_local] |
| 83 | ) -> torch.Tensor: |
| 84 | """All-gather local logits along the vocab dimension to reconstruct [H, V_global].""" |
no outgoing calls
no test coverage detected