(self)
| 2161 | "managed_gradient_accumulation=False is not supported with DeepCompile" |
| 2162 | |
| 2163 | def _broadcast_model(self): |
| 2164 | if self.dist_backend is None: |
| 2165 | return |
| 2166 | |
| 2167 | def is_replicated(p): |
| 2168 | if hasattr(p, "ds_status") and p.ds_status is not ZeroParamStatus.AVAILABLE: |
| 2169 | return False |
| 2170 | elif hasattr(p, 'ds_optim_param'): |
| 2171 | # do not broadcast OptimizedLinear parameters, they are unique per base weight shard |
| 2172 | return False |
| 2173 | return True |
| 2174 | |
| 2175 | for n, p in self.module.named_parameters(): |
| 2176 | # Broadcast the model for different parameters |
| 2177 | if is_moe_param(p): |
| 2178 | if torch.is_tensor(p) and is_replicated(p): |
| 2179 | dist.broadcast(view_as_uint8(p.data), |
| 2180 | groups._get_expert_broadcast_src_rank(p.group_name), |
| 2181 | group=self.expert_data_parallel_group[p.group_name]) |
| 2182 | else: |
| 2183 | if torch.is_tensor(p) and is_replicated(p): |
| 2184 | dist.broadcast(view_as_uint8(p.data), |
| 2185 | groups._get_broadcast_src_rank(), |
| 2186 | group=self.seq_data_parallel_group) |
| 2187 | |
| 2188 | @staticmethod |
| 2189 | def __check_params(model: Module, dtype: torch.dtype) -> None: |
no test coverage detected