Enable scoped Qwen3.8 Omni inference and CPU TTS compatibility

This commit is contained in:
tzhouam committed 2026-09-23 10:01:21 +08:00
1 parent 75b65f859b
commit b039b6a5bd
16 files changed
+555 -18

No files matched your search

+17
View File
@@ -632,6 +632,8 @@ def test_vllm_omni_stage_config_public_fields_use_typed_stage_realizations():
def test_runtime_config_fields_match_structured_runtime_scope():
assert {f.name for f in fields(OmniStageRuntimeConfig)} == {
"additional_config",
"backend",
"resource_budget",
"distributed_executor_backend",
"worker_cls",
"devices",
@@ -711,6 +713,8 @@ def test_sub_config_fields_match_structured_scopes():
"task_type",
"codec_frame_rate_hz",
"enforce_eager",
"language_model_only",
"cpu_offload_gb",
"max_cudagraph_capture_size",
"enable_flashinfer_autotune",
"enable_multithread_weight_load",
@@ -1273,6 +1277,19 @@ def test_from_pipeline_config_derives_has_sampling_extra_args_from_stage_default
assert stage.model_config.has_sampling_extra_args is True
def test_qwen3_5_large_model_execution_overrides_have_a_stage_owner():
from vllm_omni.engine.stage_init_utils import _project_omni_stage_engine_args
stage = _from_pipeline_key(
"qwen3_5",
cli_overrides={"language_model_only": True, "cpu_offload_gb": 2.0},
).stage_by_id(0)
args = _project_omni_stage_engine_args(stage)
assert args["language_model_only"] is True
assert args["cpu_offload_gb"] == 2.0
def test_diffusion_config_preserves_existing_coercion_hooks():
import torch
+8 -3
View File
@@ -10,11 +10,9 @@ opaquely. Spark-X2.5 hit exactly that; these tests pin the general case.
from __future__ import annotations
import pytest
from vllm_omni.config.pipeline_registry import OMNI_PIPELINES
from vllm_omni.config.stage_config import StageExecutionType
from vllm_omni.config.vllm_native_pipelines import LLAMA_PIPELINE
from vllm_omni.config.vllm_native_pipelines import LLAMA_PIPELINE, QWEN3_5_PIPELINE
def test_llama_resolves_from_the_registry():
@@ -48,3 +46,10 @@ def test_registering_llama_is_keyed_on_architecture_not_checkpoint():
particular weights."""
assert LLAMA_PIPELINE.model_type == "llama"
assert LLAMA_PIPELINE.hf_architectures == ("LlamaForCausalLM",)
def test_qwen3_5_conditional_generation_resolves():
assert OMNI_PIPELINES["qwen3_5"] is QWEN3_5_PIPELINE
assert QWEN3_5_PIPELINE.get_validation_errors() == []
assert QWEN3_5_PIPELINE.hf_architectures == ("Qwen3_5ForConditionalGeneration",)
assert QWEN3_5_PIPELINE.stages[0].execution_type is StageExecutionType.LLM_AR
+35 -1
View File
@@ -4,7 +4,7 @@ from typing import NamedTuple
import pytest
import torch
from vllm_omni.core.prefix_cache import OmniTensorPrefixCache
from vllm_omni.core.prefix_cache import OmniTensorPrefixCache, _PendingAsyncWrite
pytestmark = [pytest.mark.core_model, pytest.mark.cpu]
@@ -163,6 +163,40 @@ def test_update_no_multimodal():
assert torch.all(slot_states == new_states)
def test_pending_write_skips_vllm_unmapped_slot_sentinel():
class CompletedEvent:
def synchronize(self):
pass
cache = get_omni_pcache_with_mm_tensors({"vision": HIDDEN_SIZE}, seq_len=3)
cache._pending_write = _PendingAsyncWrite(
event=CompletedEvent(),
num_tokens=3,
slots_cpu=torch.tensor([8, -1, 9], dtype=torch.int32),
hidden_cpu=torch.tensor([[1.0, 1.0], [99.0, 99.0], [2.0, 2.0]]),
mm_cpu={"vision": torch.tensor([[3.0, 3.0], [99.0, 99.0], [4.0, 4.0]])},
)
cache._consume_pending_write()
assert cache._pending_write is None
assert cache.hidden_states_cache.view(-1, HIDDEN_SIZE)[8:10].tolist() == [[1.0, 1.0], [2.0, 2.0]]
assert cache.mm_outputs_cache["vision"].view(-1, HIDDEN_SIZE)[8:10].tolist() == [[3.0, 3.0], [4.0, 4.0]]
def test_synchronous_write_skips_vllm_unmapped_slot_sentinel():
cache = get_omni_pcache_with_mm_tensors({"vision": HIDDEN_SIZE}, seq_len=3)
cache.update_omni_tensor_prefix_cache(
hidden_states=torch.tensor([[1.0, 1.0], [99.0, 99.0], [2.0, 2.0]]),
multimodal_outputs={"vision": torch.tensor([[3.0, 3.0], [99.0, 99.0], [4.0, 4.0]])},
num_tokens_unpadded=3,
slot_mapping=torch.tensor([8, -1, 9], dtype=torch.int32),
)
assert cache.hidden_states_cache.view(-1, HIDDEN_SIZE)[8:10].tolist() == [[1.0, 1.0], [2.0, 2.0]]
assert cache.mm_outputs_cache["vision"].view(-1, HIDDEN_SIZE)[8:10].tolist() == [[3.0, 3.0], [4.0, 4.0]]
def test_update_uses_precomputed_hidden_states_cpu():
"""Precomputed CPU staging should be the only hidden-state cache source."""
cache = get_omni_pcache()