Refactor model mode initialization and enhance error handling in AsyncOmni. Update worker type retrieval in omni_stage and add audio token handling in Qwen3OmniMoe classes for improved robustness.

Signed-off-by: tzhouam <tzhouam@connect.ust.hk>
This commit is contained in:
tzhouam committed 2026-03-09 06:17:08 +00:00
1 parent 9cdbcec44b
commit e6d4cdd71a
4 files changed
+25 -6

No files matched your search

+17 -2
View File
@@ -401,7 +401,10 @@ class AsyncOmni(OmniBase):
) -> AsyncGenerator[OmniRequestOutput, None]:
all_stages_finished = {stage_id: False for stage_id in range(final_stage_id_for_e2e + 1)}
submit_flag = True
_loop_iter = 0
_last_progress_ts = time.time()
while not all(all_stages_finished.values()):
_loop_iter += 1
for stage_id, stage in enumerate(self.stage_list[: final_stage_id_for_e2e + 1]):
if all_stages_finished[stage_id]:
continue
@@ -410,6 +413,7 @@ class AsyncOmni(OmniBase):
except asyncio.QueueEmpty:
await asyncio.sleep(0.001)
continue
_last_progress_ts = time.time()
engine_outputs, finished, output_to_yield = self._process_single_result(
result,
stage,
@@ -418,11 +422,20 @@ class AsyncOmni(OmniBase):
)
if submit_flag and stage_id == 0:
submit_flag = False
prompt_token_ids = engine_outputs.prompt_token_ids
prompt_token_ids = getattr(engine_outputs, "prompt_token_ids", None)
if prompt_token_ids is None:
prompt_token_ids = []
engine_input = copy.deepcopy(prompt)
next_prompt_len = max(1, compute_talker_prompt_ids_length(prompt_token_ids))
try:
next_prompt_len = max(1, compute_talker_prompt_ids_length(prompt_token_ids))
except Exception:
raise
engine_input["prompt_token_ids"] = [0] * next_prompt_len
engine_input["multi_modal_data"] = engine_input["mm_processor_kwargs"] = None
for _mm_key in ("mm_kwargs", "mm_hashes", "mm_placeholders", "multi_modal_uuids"):
engine_input.pop(_mm_key, None)
if engine_input.get("type") == "multimodal":
engine_input["type"] = "token"
for i in range(1, len(self.stage_list)):
task = {
"request_id": request_id,
@@ -709,6 +722,8 @@ class AsyncOmni(OmniBase):
OMNI: Required by upstream OpenAIServingModels.__init__ which
accesses engine_client.renderer.
"""
if self.input_processor is None:
return None
return self.input_processor.renderer
async def do_log_stats(self) -> None:
+1 -1
View File
@@ -207,7 +207,7 @@ def _sequential_init_lock(engine_args: dict[str, Any], stage_init_timeout: int =
def _resolve_worker_cls(engine_args: dict[str, Any]) -> None:
worker_type = engine_args.pop("worker_type", None)
worker_type = engine_args.get("worker_type", None)
if not worker_type:
return
worker_cls = engine_args.get("worker_cls")