Coverage for / home / jenkins / .local / lib / python3.10 / site-packages / hyper_parallel / tools / dryrun / patches / __init__.py: 100%
10 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-12-05 05:12 +0800
« prev ^ index » next coverage.py v7.13.1, created at 2026-12-05 05:12 +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"""Unified dry-run patch entry points separating trainer and model patches."""
17from hyper_parallel.tools.dryrun.patches.models import (
18 install_moe_replay,
19 install_tp_cross_entropy_replay,
20)
21from hyper_parallel.tools.dryrun.patches.registry import (
22 install_registered_model_patches,
23 is_patches_installed,
24 mark_patches_installed,
25 register_model_patch,
26)
27from hyper_parallel.tools.dryrun.patches.trainer import (
28 FakeHostScalarShim,
29 fsdp_device_context,
30 install_distributed_patches,
31 install_model_build_patches,
32 install_optimizer_patches,
33 install_trainer_patches,
34 is_model_materialization_deferred,
35 model_build_context,
36 token_count_scalar_context,
37)
40def install_dryrun_patches() -> None:
41 """Install all trainer-pipeline patches and registered model patches."""
42 if is_patches_installed():
43 return
44 install_trainer_patches()
45 install_registered_model_patches()
46 mark_patches_installed()
49__all__ = [
50 "FakeHostScalarShim",
51 "fsdp_device_context",
52 "install_distributed_patches",
53 "install_dryrun_patches",
54 "install_model_build_patches",
55 "install_moe_replay",
56 "install_optimizer_patches",
57 "install_registered_model_patches",
58 "install_tp_cross_entropy_replay",
59 "install_trainer_patches",
60 "is_model_materialization_deferred",
61 "is_patches_installed",
62 "model_build_context",
63 "register_model_patch",
64 "token_count_scalar_context",
65]