Coverage for / home / jenkins / .local / lib / python3.10 / site-packages / hyper_parallel / __init__.py: 100%
18 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-07-06 05:41 +0800
« prev ^ index » next coverage.py v7.13.1, created at 2026-07-06 05:41 +0800
1# Copyright 2026 Huawei Technologies Co., Ltd
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14# ============================================================================
15"""hyper parallel interface"""
17__all__ = ["get_platform", "DFunction", "fully_shard", "hsdp_sync_stream", "HSDPModule", "DTensor",
18 "Layout", "DeviceMesh", "init_device_mesh", "get_current_mesh", "distribute_module",
19 "init_parameters", "init_empty_weights", "init_on_device",
20 "shard_module", "custom_shard", "parallelize_value_and_grad", "SkipDTensorDispatch",
21 "MetaStep", "MetaStepType", "BatchDimSpec", "PipelineStage", "ScheduleInterleaved1F1B",
22 "ScheduleMPipeTranspose",
23 "init_process_group", "destroy_process_group", "get_process_group_ranks", "get_backend", "split_group",
24 "get_group_local_rank", "mark_created_groups",
25 "ContextParallel", "AsyncContextParallel",
26 "AsyncDSAIndexerContextParallel", "AsyncDSAIndexerLossContextParallel",
27 "AsyncDSASparseAttentionContextParallel",
28 "DSAIndexerContextParallel", "DSAIndexerLossContextParallel", "DSASparseAttentionContextParallel",
29 "ColwiseParallel", "NoParallel", "RowwiseParallel", "SequenceParallel",
30 "PrepareModuleInput", "PrepareModuleInputOutput", "PrepareModuleOutput",
31 "ParallelStyle", "parallelize_module", "manual_seed"]
33from hyper_parallel.platform import get_platform
34from hyper_parallel.core.shard.dfunction import DFunction
35from hyper_parallel.core.dtensor.layout import Layout
36from hyper_parallel.core.dtensor.device_mesh import DeviceMesh, _mesh_resources, init_device_mesh
37from hyper_parallel.core.dtensor.dtensor import DTensor, SkipDTensorDispatch, distribute_module
38from hyper_parallel.core.dtensor.parameter_init import init_parameters
39from hyper_parallel.core.dtensor.init_weights import init_empty_weights, init_on_device
40from hyper_parallel.core.shard.api import shard_module
41from hyper_parallel.core.shard.api import parallelize_value_and_grad
42from hyper_parallel.core.shard.custom_shard import custom_shard
43from hyper_parallel.core.pipeline_parallel import (PipelineStage, ScheduleInterleaved1F1B, ScheduleMPipeTranspose,
44 MetaStep, MetaStepType, BatchDimSpec)
45from hyper_parallel.collectives.cc import (init_process_group, destroy_process_group, get_process_group_ranks,
46 get_backend, split_group, get_group_local_rank, mark_created_groups)
47from hyper_parallel.core.context_parallel import (
48 AsyncDSAIndexerContextParallel,
49 AsyncDSAIndexerLossContextParallel,
50 AsyncDSASparseAttentionContextParallel,
51 ContextParallel,
52 AsyncContextParallel,
53 DSAIndexerContextParallel,
54 DSAIndexerLossContextParallel,
55 DSASparseAttentionContextParallel,
56)
57from hyper_parallel.core.tensor_parallel import (
58 ColwiseParallel,
59 NoParallel,
60 ParallelStyle,
61 PrepareModuleInput,
62 PrepareModuleInputOutput,
63 PrepareModuleOutput,
64 RowwiseParallel,
65 SequenceParallel,
66 parallelize_module,
67)
68from hyper_parallel.core.dtensor.random import manual_seed
69from hyper_parallel.core.fully_shard.api import fully_shard, hsdp_sync_stream, HSDPModule
71get_current_mesh = _mesh_resources.get_current_mesh