Diff Coverage

Diff: origin/master...HEAD, staged and unstaged changes

Source File Diff Coverage (%) Missing Lines
hyper_parallel/components/functional/aux_loss.py 97.5% 73
hyper_parallel/core/utils/moe_utils.py 100%  
hyper_parallel/trainer/base.py 81.8% 582-583
hyper_parallel/components/functional/aux_loss.py
69
70
71
72
73
74
75
76
    state = _AUX_LOSS_STATE.get()
    if state is None or not state.active or not loss.requires_grad:
        return
    if loss.numel() != 1:
        raise ValueError("Auxiliary gradient scaling requires a scalar task loss")

    def save_scale(gradient: torch.Tensor) -> None:
        """Capture the actual multiplier after token and parallel weighting.
hyper_parallel/trainer/base.py
578
579
580
581
582
583
584
585
586
587
        return loss, loss_dict

    def _init_callbacks(self):
        """Initialize callbacks."""
        dp_cp_mesh = self.mesh.dp_cp_mesh
        self.moe_monitor = MoEMonitorCallback(
            self.model,
            dp_group=dp_cp_mesh.get_group() if dp_cp_mesh is not None else None,
            tp_group=self.device_mesh["tp"].get_group() if self.mesh.sequence_parallel else None,
        )