Diff Coverage

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

Source File Diff Coverage (%) Missing Lines
hyper_parallel/core/fully_shard/api.py 66.7% 789
hyper_parallel/platform/mindspore/platform.py 75.0% 1504
hyper_parallel/platform/platform.py 75.0% 946
hyper_parallel/platform/torch/fully_shard/state_dict_utils.py 97.2% 183
hyper_parallel/platform/torch/platform.py 60.0% 933,936
hyper_parallel/core/fully_shard/api.py
785
786
787
788
789
790
791
792
793

    Returns:
        None.
    """
    return platform.set_model_state_dict(model, model_state_dict, options=options)


def hsdp_sync_stream():
    """Wait for hsdp gradient handle to be completed."""
hyper_parallel/platform/mindspore/platform.py
1500
1501
1502
1503
1504
1505
1506
1507
1508

        Raises:
            NotImplementedError: MindSpore support is not yet implemented.
        """
        raise NotImplementedError(
            "set_model_state_dict is not yet supported on MindSpore"
        )

    @staticmethod
hyper_parallel/platform/platform.py
942
943
944
945
946
947
948
949
950

        Raises:
            NotImplementedError: Platform subclasses must implement this method.
        """
        raise NotImplementedError(
            "Platform subclasses must implement set_model_state_dict"
        )

    @staticmethod
hyper_parallel/platform/torch/fully_shard/state_dict_utils.py
179
180
181
182
183
184
185
186
187
            unexpected_keys.append(key)
            continue
        if isinstance(target, DTensor):
            if isinstance(val, DTensor):
                scattered[key] = val
            else:
                # Slice a plain (global) tensor into a DTensor shard.
                placements = (
                    target.layout.alias_placements if target.layout else target.placements
hyper_parallel/platform/torch/platform.py
929
930
931
932
933
934
935
936
937
938
939
940
        Delegates to torch-specific implementation that scatters full tensors
        into DTensor shards and performs an in-place load.
        """
        # pylint: disable=C0415
        from hyper_parallel.platform.torch.fully_shard.state_dict_utils import (
            set_model_state_dict as _set_model_state_dict,
        )
        return _set_model_state_dict(model, model_state_dict, options=options)

    @staticmethod
    def save_checkpoint(cell: Module, file_path: str, ckpt_format: str = "safetensors") -> None:
        if ckpt_format == "safetensors":