[Misc] Refactor static stage metadata lookups (#7602)
Signed-off-by: Nick Cao <ncao@redhat.com> Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
1 parent
1586c41ae4
commit
1d3dc8bf83
5 files changed
+41
-18
No files matched your search
@@ -186,7 +186,7 @@ class AsyncOmni(AsyncOmniBase, EngineClient):
|
||||
|
||||
# Reject diffusion list-prompt early with a clear API error.
|
||||
if isinstance(prompt, list) and any(
|
||||
getattr(client, "stage_type", "") == "diffusion" for client in getattr(self.engine, "stage_clients", [])
|
||||
stage_config.stage_type == "diffusion" for stage_config in self.engine.stage_configs
|
||||
):
|
||||
raise ValueError(
|
||||
"Diffusion stages accept only a single prompt per request. "
|
||||
@@ -626,7 +626,7 @@ class AsyncOmni(AsyncOmniBase, EngineClient):
|
||||
|
||||
def _split_stage_ids_by_type(self, stage_ids: list[int] | None = None) -> tuple[list[int], list[int]]:
|
||||
"""Split stage ids into AR/LLM (EngineCore) vs diffusion (worker RPC)."""
|
||||
n_stages = len(self.engine.stage_clients)
|
||||
n_stages = len(self.engine.stage_configs)
|
||||
if stage_ids is None:
|
||||
stage_ids = list(range(n_stages))
|
||||
else:
|
||||
@@ -640,8 +640,8 @@ class AsyncOmni(AsyncOmniBase, EngineClient):
|
||||
ar_stage_ids: list[int] = []
|
||||
diffusion_stage_ids: list[int] = []
|
||||
for sid in stage_ids:
|
||||
client = self.engine.stage_clients[sid]
|
||||
if getattr(client, "stage_type", "llm") == "diffusion":
|
||||
stage_config = self.engine.stage_configs[sid]
|
||||
if stage_config.stage_type == "diffusion":
|
||||
diffusion_stage_ids.append(sid)
|
||||
else:
|
||||
ar_stage_ids.append(sid)
|
||||
|
||||
@@ -155,13 +155,13 @@ class AsyncOmniBase(OmniBase):
|
||||
|
||||
def _get_comprehension_stage_index(self) -> int | None:
|
||||
fallback_idx: int | None = None
|
||||
for idx, stage_client in enumerate(self.engine.stage_clients):
|
||||
for idx, stage_config in enumerate(self.engine.stage_configs):
|
||||
stage_vllm_config = self.engine.stage_vllm_configs[idx]
|
||||
if stage_vllm_config is None:
|
||||
continue
|
||||
if fallback_idx is None:
|
||||
fallback_idx = idx
|
||||
if stage_client.is_comprehension:
|
||||
if stage_config.is_comprehension:
|
||||
return idx
|
||||
return fallback_idx
|
||||
|
||||
@@ -186,13 +186,11 @@ class AsyncOmniBase(OmniBase):
|
||||
|
||||
def get_diffusion_od_config(self) -> Any | None:
|
||||
"""Return the diffusion-stage config when the pipeline has one."""
|
||||
saw_diffusion_stage = False
|
||||
saw_diffusion_stage = any(stage_config.stage_type == "diffusion" for stage_config in self.engine.stage_configs)
|
||||
for stage_client in self.engine.stage_clients:
|
||||
if getattr(stage_client, "stage_type", None) != "diffusion":
|
||||
continue
|
||||
|
||||
saw_diffusion_stage = True
|
||||
|
||||
od_config = getattr(stage_client, "od_config", None)
|
||||
if od_config is not None:
|
||||
return od_config
|
||||
|
||||
Reference in new issue
Block a user