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

Class TPInfo

src/fused_mm_sampling/tp_info.py:14–29  ·  view source on GitHub ↗

Tensor parallel context.

Source from the content-addressed store, hash-verified

12
13@dataclass(frozen=True)
14class TPInfo:
15 """Tensor parallel context."""
16
17 rank: int
18 size: int
19
20 def is_rank0(self) -> bool:
21 return self.rank == 0
22
23 def rank0_print(self, *args, **kwargs) -> None:
24 if self.is_rank0():
25 print(*args, **kwargs)
26
27 @classmethod
28 def from_world(cls) -> "TPInfo":
29 return cls(rank=dist.get_rank(), size=dist.get_world_size())
30
31
32TP1 = TPInfo(rank=0, size=1)

Callers 2

mainFunction · 0.90
tp_info.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected