Coverage for  / home / jenkins / .local / lib / python3.10 / site-packages / hyper_parallel / tools / dryrun / patches / trainer / __init__.py: 100%

9 statements  

« 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"""Trainer-pipeline patches for dry-run (model build, distributed, optimizer, scalars).""" 

16 

17from hyper_parallel.tools.dryrun.patches.trainer.distributed import ( 

18 fsdp_device_context, 

19 install_distributed_patches, 

20) 

21from hyper_parallel.tools.dryrun.patches.trainer.host_scalar import ( 

22 FakeHostScalarShim, 

23 token_count_scalar_context, 

24) 

25from hyper_parallel.tools.dryrun.patches.trainer.model_builder import ( 

26 install_model_build_patches, 

27 is_model_materialization_deferred, 

28 model_build_context, 

29) 

30from hyper_parallel.tools.dryrun.patches.trainer.optimizer import ( 

31 install_fake_subgroup_patch, 

32 install_muon_metadata_patch, 

33 install_optimizer_patches, 

34) 

35 

36 

37def install_trainer_patches() -> None: 

38 """Install all process-local trainer-pipeline patches for dry-run.""" 

39 install_model_build_patches() 

40 install_distributed_patches() 

41 install_optimizer_patches() 

42 

43 

44__all__ = [ 

45 "FakeHostScalarShim", 

46 "fsdp_device_context", 

47 "install_distributed_patches", 

48 "install_fake_subgroup_patch", 

49 "install_model_build_patches", 

50 "install_muon_metadata_patch", 

51 "install_optimizer_patches", 

52 "install_trainer_patches", 

53 "is_model_materialization_deferred", 

54 "model_build_context", 

55 "token_count_scalar_context", 

56]