(self)
| 2108 | "managed_gradient_accumulation=False is not supported with DeepCompile" |
| 2109 | |
| 2110 | def _broadcast_model(self): |
| 2111 | if self.dist_backend is None: |
| 2112 | return |
| 2113 | |
| 2114 | def is_replicated(p): |
| 2115 | if hasattr(p, "ds_status") and p.ds_status is not ZeroParamStatus.AVAILABLE: |
| 2116 | return False |
| 2117 | elif hasattr(p, 'ds_optim_param'): |
| 2118 | # do not broadcast OptimizedLinear parameters, they are unique per base weight shard |
| 2119 | return False |
| 2120 | return True |
| 2121 | |
| 2122 | for n, p in self.module.named_parameters(): |
| 2123 | # Broadcast the model for different parameters |
| 2124 | if is_moe_param(p): |
| 2125 | if torch.is_tensor(p) and is_replicated(p): |
| 2126 | dist.broadcast(view_as_uint8(p.data), |
| 2127 | groups._get_expert_broadcast_src_rank(p.group_name), |
| 2128 | group=self.expert_data_parallel_group[p.group_name]) |
| 2129 | else: |
| 2130 | if torch.is_tensor(p) and is_replicated(p): |
| 2131 | dist.broadcast(view_as_uint8(p.data), |
| 2132 | groups._get_broadcast_src_rank(), |
| 2133 | group=self.seq_data_parallel_group) |
| 2134 | |
| 2135 | @staticmethod |
| 2136 | def __check_params(model: Module, dtype: torch.dtype) -> None: |
no test coverage detected