[Model] Add Ming-flash-omni-2.0 Image Generation (Diffusion) Stage (#2875)
Signed-off-by: ZhengWG <zwg0606@gmail.com> Signed-off-by: Zheng Wengang <zwg0606@gmail.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Yuanheng Zhao <54058983+yuanheng-zhao@users.noreply.github.com>
This commit is contained in:
25 files changed
+2614
-42
No files matched your search
@@ -22,17 +22,18 @@ class CfgCompanionTracker:
|
||||
self._companion_to_parent: dict[str, str] = {} # companion -> parent
|
||||
self._done: dict[str, set[str]] = {} # parent -> completed companion ids
|
||||
self._pending_parents: dict[str, dict[str, Any]] = {} # parent -> deferred result
|
||||
self._companion_outputs: dict[str, Any] = {} # companion_id -> engine output
|
||||
|
||||
def is_companion(self, req_id: str) -> bool:
|
||||
return req_id in self._companion_ids
|
||||
|
||||
def has_companions(self, parent_id: str) -> bool:
|
||||
return parent_id in self._companion_map
|
||||
|
||||
def get_parent_id(self, req_id: str) -> str | None:
|
||||
"""Return the parent request id for a companion, or None."""
|
||||
return self._companion_to_parent.get(req_id)
|
||||
|
||||
def has_companions(self, parent_id: str) -> bool:
|
||||
return parent_id in self._companion_map
|
||||
|
||||
def all_companions_done(self, parent_id: str) -> bool:
|
||||
role_map = self._companion_map.get(parent_id, {})
|
||||
done_set = self._done.get(parent_id, set())
|
||||
@@ -52,6 +53,20 @@ class CfgCompanionTracker:
|
||||
self._companion_ids.add(companion_id)
|
||||
self._companion_to_parent[companion_id] = parent_id
|
||||
|
||||
def set_companion_output(self, companion_id: str, output: Any) -> None:
|
||||
"""Stash companion engine output for the parent to bundle at forward time."""
|
||||
self._companion_outputs[companion_id] = output
|
||||
|
||||
def pop_companion_outputs(self, parent_id: str) -> list[Any]:
|
||||
"""Pop companion outputs (role-registration order) for bundling into set_engine_outputs."""
|
||||
role_map = self._companion_map.get(parent_id, {})
|
||||
outputs = []
|
||||
for cid in role_map.values():
|
||||
out = self._companion_outputs.pop(cid, None)
|
||||
if out is not None:
|
||||
outputs.append(out)
|
||||
return outputs
|
||||
|
||||
def on_companion_completed(self, companion_id: str) -> str | None:
|
||||
"""Mark done. Returns parent_id only if parent is pending and all companions finished."""
|
||||
parent_id = self._companion_to_parent.get(companion_id)
|
||||
@@ -86,6 +101,7 @@ class CfgCompanionTracker:
|
||||
for companion_id in companion_ids:
|
||||
self._companion_ids.discard(companion_id)
|
||||
self._companion_to_parent.pop(companion_id, None)
|
||||
self._companion_outputs.pop(companion_id, None)
|
||||
self._done.pop(parent_id, None)
|
||||
self._pending_parents.pop(parent_id, None)
|
||||
return companion_ids
|
||||
|
||||
Reference in new issue
Block a user