MCPcopy Create free account
hub / github.com/FlashSampling/FlashSampling / _allgather_logits

Function _allgather_logits

src/fused_mm_sampling/core.py:77–81  ·  view source on GitHub ↗

All-gather local logits along the vocab dimension to reconstruct [H, V_global].

(
    logits: torch.Tensor,  # [H, V_local]
)

Source from the content-addressed store, hash-verified

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
81def _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]."""

Callers 4

sampleFunction · 0.85
greedy_sampleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected