MCPcopy Create free account
hub / github.com/apple/axlearn / HybridMeshShape

Class HybridMeshShape

axlearn/common/utils.py:95–116  ·  view source on GitHub ↗

A mesh shape for hybrid (i.e., ICI and DCN) parallelism. For example, with mesh axes (data, model): - Pure fsdp on a v4-8: HybridMeshShape(ici_mesh_shape=(1, 4), dcn_mesh_shape=(1, 1)) - Two-way data parallelism over 2 H100 nodes, and fsdp within-node: HybridMeshShape(ic

Source from the content-addressed store, hash-verified

93
94@dataclasses.dataclass
95class HybridMeshShape:
96 """A mesh shape for hybrid (i.e., ICI and DCN) parallelism.
97
98 For example, with mesh axes (data, model):
99 - Pure fsdp on a v4-8:
100 HybridMeshShape(ici_mesh_shape=(1, 4), dcn_mesh_shape=(1, 1))
101 - Two-way data parallelism over 2 H100 nodes, and fsdp within-node:
102 HybridMeshShape(ici_mesh_shape=(1, 8), dcn_mesh_shape=(2, 1))
103 """
104
105 ici_mesh_shape: MeshShape
106 dcn_mesh_shape: MeshShape
107
108 def __post_init__(self) -> None:
109 if len(self.ici_mesh_shape) != len(self.dcn_mesh_shape):
110 raise ValueError(
111 f"{self.ici_mesh_shape=} should have the same length as {self.dcn_mesh_shape}."
112 )
113
114 def __len__(self):
115 assert len(self.ici_mesh_shape) == len(self.dcn_mesh_shape)
116 return len(self.ici_mesh_shape)
117
118
119# "device" = Accelerator memory, e.g. HBM.

Callers 8

_trainer_kwargsFunction · 0.90
get_trainer_kwargsFunction · 0.90
reshape_devicesFunction · 0.90
test_lengthMethod · 0.90
test_reshape_devicesMethod · 0.90
create_device_meshFunction · 0.85

Calls

no outgoing calls