|
11 | 11 |
|
12 | 12 | import yaml |
13 | 13 |
|
| 14 | +from vllm_omni.config.stage_config import load_deploy_config |
| 15 | + |
14 | 16 |
|
15 | 17 | def modify_stage_config( |
16 | 18 | yaml_path: str, |
@@ -669,25 +671,14 @@ def get_deploy_config_stage(rel_path: str, stage_id: int) -> dict[str, Any]: |
669 | 671 | raise KeyError(f"No stage_id={stage_id} in deploy config {rel_path!r}") |
670 | 672 |
|
671 | 673 |
|
672 | | -def get_deploy_duplex_max_sessions(rel_path: str, default: int = 1) -> int: |
673 | | - """Return ``duplex_session.max_sessions`` from a deploy yaml. |
| 674 | +def get_deploy_duplex_max_sessions(rel_path: str) -> int: |
| 675 | + """Return the duplex session capacity a deploy yaml admits. |
674 | 676 |
|
675 | | - ``default`` mirrors ``DuplexSessionConfig.max_sessions`` so a deploy config |
676 | | - that declares no capacity resolves to the limit the server itself applies. |
677 | | - A declared but invalid capacity raises instead of silently falling back to a |
678 | | - limit the server would never use, matching the runtime validation. |
| 677 | + Loads through ``load_deploy_config`` so ``base_config`` merging and |
| 678 | + ``DuplexSessionRuntimeConfig`` defaults stay in lockstep with the server |
| 679 | + instead of being re-implemented here. |
679 | 680 | """ |
680 | | - with open(get_deploy_config_path(rel_path), encoding="utf-8") as f: |
681 | | - cfg = yaml.safe_load(f) or {} |
682 | | - |
683 | | - duplex_session = cfg.get("duplex_session") |
684 | | - if not isinstance(duplex_session, dict) or "max_sessions" not in duplex_session: |
685 | | - return default |
686 | | - |
687 | | - max_sessions = duplex_session["max_sessions"] |
688 | | - if not isinstance(max_sessions, int) or isinstance(max_sessions, bool) or max_sessions <= 0: |
689 | | - raise ValueError(f"duplex_session.max_sessions must be a positive int in {rel_path!r}, got {max_sessions!r}") |
690 | | - return max_sessions |
| 681 | + return load_deploy_config(get_deploy_config_path(rel_path)).duplex_session.max_sessions |
691 | 682 |
|
692 | 683 |
|
693 | 684 | def _stage_ids_from_deploy_yaml(stage_config_path: str) -> list[int]: |
|
0 commit comments