Coverage for  / home / jenkins / .local / lib / python3.10 / site-packages / hyper_parallel / auto_parallel / sapp_ppb / pp_modeling / __init__.py: 67%

12 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-08-21 04:29 +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"""Pipeline Parallelism modeling and load balancing for auto-parallel strategy search.""" 

16 

17from importlib import import_module as _import_module 

18 

19from hyper_parallel.auto_parallel.sapp_ppb.pp_modeling.pp_structs import ( 

20 PPStrategyResult, 

21 PPBOutput, 

22 RecomputeType, 

23) 

24from hyper_parallel.auto_parallel.sapp_ppb.pp_config_builder.yaml_parser import ( 

25 YamlOptimizationConfig, 

26 parse_yaml_for_optimization, 

27) 

28 

29_LAZY_EXPORTS = { 

30 "PPOptimizer": "hyper_parallel.auto_parallel.sapp_ppb.pp_optimizer", 

31} 

32 

33 

34def __getattr__(name): # pylint: disable=invalid-name 

35 """Lazily import PPOptimizer to avoid circular imports.""" 

36 if name not in _LAZY_EXPORTS: 

37 raise AttributeError(f"module {__name__!r} has no attribute {name!r}") 

38 

39 module = _import_module(_LAZY_EXPORTS[name]) 

40 value = getattr(module, name) 

41 globals()[name] = value 

42 return value 

43 

44 

45__all__ = [ 

46 "PPStrategyResult", 

47 "PPBOutput", 

48 "RecomputeType", 

49 "YamlOptimizationConfig", 

50 "parse_yaml_for_optimization", 

51 "PPOptimizer", # pylint: disable=E0603 

52]