Diff Coverage

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

Source File Diff Coverage (%) Missing Lines
hyper_parallel/components/modules/moe_utils.py 100%  
hyper_parallel/components/modules/shared_compressed_dsa_attention.py 92.3% 285,496,502
hyper_parallel/data/batching/runtime_input.py 50.0% 151
hyper_parallel/trainer/base.py 62.5% 618-620
hyper_parallel/trainer/callbacks/logging_callback.py 100%  
hyper_parallel/components/modules/shared_compressed_dsa_attention.py
281
282
283
284
285
286
287
288
289
        The runtime calls this before capture. Eager retains its real boundaries;
        graph inputs carry token-shaped metadata, not a variable document list.
        """
        if self.local_query_start != 0 or self.local_query_length != self.global_sequence_length:
            return
        self.segment_start_mask(device)
        object.__setattr__(self, "_use_prepared_packing_inputs", True)

    def router_metadata(self, device: torch.device) -> tuple[torch.Tensor, int]:
492
493
494
495
496
497
498
499
500
        """Expose packing tensors with a schema independent of document count and S."""
        if self._use_prepared_packing_inputs:
            return [self._prepared_starts, self._prepared_positions,
                    self._prepared_masks, self._prepared_sequences], ("packing",)
        return [self.cu_seq_lens], (self.local_query_start, self.local_query_length, self.global_sequence_length)

    @classmethod
    def pytree_unflatten(cls, children: Any, context: tuple) -> SharedCompressedPackedSequence:
        """Restore prepared metadata without reading boundary values during capture."""
498
499
500
501
502
503
504
505
506
    @classmethod
    def pytree_unflatten(cls, children: Any, context: tuple) -> SharedCompressedPackedSequence:
        """Restore prepared metadata without reading boundary values during capture."""
        if context != ("packing",):
            return cls(children[0], *context)
        starts, positions, masks, sequences = children
        reference = next(iter(starts.values()))
        length = reference.shape[-1]
        packed = cls(reference.new_empty(0), 0, length, length)
hyper_parallel/data/batching/runtime_input.py
147
148
149
150
151
152
153
154

        Returns:
            Inputs used for both graph capture and replay. Eager never calls this hook.
        """
        return model_inputs

    def runtime_input_fields(self) -> tuple[str, ...]:
        """Return the forward fields exclusively owned by this adapter.
hyper_parallel/trainer/base.py
614
615
616
617
618
619
620
621
622
623
624
        # A replayed graph does not update Python module attributes.
        # Return detached router metrics explicitly for the standard callbacks.
        moe_monitor = getattr(self, "moe_monitor", None)
        if moe_monitor is not None:
            aux_loss = moe_monitor.last_mean_aux_loss
            if aux_loss is not None:
                loss_dict["router_aux_loss"] = aux_loss
        return loss, loss_dict

    def _init_callbacks(self):
        """Initialize callbacks."""