[Misc] Remove Dynin-Omni and dots.tts support (#7655)
Signed-off-by: wangyu <410167048@qq.com> Signed-off-by: Yueqian Lin <linyueqian@outlook.com> Co-authored-by: Yueqian Lin <linyueqian@outlook.com>
This commit is contained in:
1 parent
3f94c417be
commit
6a03e45c34
56 files changed
+133
-12749
No files matched your search
@@ -167,7 +167,7 @@ def test_inventory_matches_reviewed_snapshot_counts():
|
||||
EnvironmentVariableCategory.PUBLIC_OMNI: 28,
|
||||
EnvironmentVariableCategory.INHERITED_VLLM: 20,
|
||||
EnvironmentVariableCategory.PLATFORM_EXTERNAL: 27,
|
||||
EnvironmentVariableCategory.MODEL_SPECIFIC: 67,
|
||||
EnvironmentVariableCategory.MODEL_SPECIFIC: 57,
|
||||
EnvironmentVariableCategory.BENCHMARK_TRANSITIONAL: 20,
|
||||
EnvironmentVariableCategory.INTERNAL: 2,
|
||||
}
|
||||
@@ -178,10 +178,10 @@ def test_inventory_matches_reviewed_snapshot_counts():
|
||||
if item.category is EnvironmentVariableCategory.MODEL_SPECIFIC
|
||||
)
|
||||
assert {disposition: disposition_counts[disposition] for disposition in ModelEnvironmentVariableDisposition} == {
|
||||
ModelEnvironmentVariableDisposition.PROMOTE: 38,
|
||||
ModelEnvironmentVariableDisposition.REQUEST_SCOPE: 6,
|
||||
ModelEnvironmentVariableDisposition.PROMOTE: 31,
|
||||
ModelEnvironmentVariableDisposition.REQUEST_SCOPE: 5,
|
||||
ModelEnvironmentVariableDisposition.EXTERNAL: 0,
|
||||
ModelEnvironmentVariableDisposition.INTERNALIZE: 16,
|
||||
ModelEnvironmentVariableDisposition.INTERNALIZE: 14,
|
||||
ModelEnvironmentVariableDisposition.DEPRECATE_REMOVE: 7,
|
||||
}
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@ def test_from_pipeline_config_normalizes_stage_engine_extras_without_expanding_s
|
||||
def test_frontend_log_stats_flag_is_not_an_unowned_stage_argument(disabled):
|
||||
from vllm_omni.engine.stage_init_utils import build_engine_args_dict_from_omni_stage_config
|
||||
|
||||
config = _from_pipeline_key("dots_tts", cli_overrides={"disable_log_stats": disabled})
|
||||
config = _from_pipeline_key("voxcpm2", cli_overrides={"disable_log_stats": disabled})
|
||||
assert config.stage_configs
|
||||
engine_args = build_engine_args_dict_from_omni_stage_config(config.stage_by_id(0), model="test-model")
|
||||
assert "disable_log_stats" not in engine_args
|
||||
|
||||
@@ -1,129 +0,0 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
|
||||
"""E2E tests for dots.tts native AR offline inference."""
|
||||
|
||||
from collections.abc import Mapping
|
||||
|
||||
import pytest
|
||||
import torch
|
||||
|
||||
from tests.helpers.mark import hardware_test
|
||||
from tests.helpers.runtime import OmniRunner
|
||||
from tests.helpers.stage_config import get_deploy_config_path
|
||||
|
||||
DOTS_TTS_MODEL = "rednote-hilab/dots.tts-soar"
|
||||
DEPLOY_CONFIG = get_deploy_config_path("dots_tts.yaml")
|
||||
SAMPLE_RATE = 48000
|
||||
|
||||
# dots.tts ships a custom tokenizer carrying the added ``<|audio_gen_start|>``
|
||||
# token, so remote code must be explicitly enabled.
|
||||
_OMNI_RUNNER_PARAM = (DOTS_TTS_MODEL, DEPLOY_CONFIG, {"trust_remote_code": True})
|
||||
|
||||
pytestmark = pytest.mark.parametrize("omni_runner", [_OMNI_RUNNER_PARAM], indirect=True)
|
||||
|
||||
|
||||
def _build_prompt(omni_runner: OmniRunner, text: str) -> dict:
|
||||
"""Wrap ``text`` in the prefix scaffold dots.tts prefill expects.
|
||||
|
||||
Unlike most TTS models here, a bare ``{"prompt": ...}`` string does not
|
||||
work: prefill needs ``[文本]<text>[文本对应语音]<|audio_gen_start|>`` as
|
||||
real Qwen2 token ids.
|
||||
"""
|
||||
from transformers import AutoTokenizer
|
||||
|
||||
from vllm_omni.model_executor.models.dots_tts.dots_tts_prompt import (
|
||||
build_dots_tts_prompt,
|
||||
)
|
||||
|
||||
tokenizer = AutoTokenizer.from_pretrained(omni_runner.model_name, trust_remote_code=True)
|
||||
return build_dots_tts_prompt(tokenizer=tokenizer, text=text)
|
||||
|
||||
|
||||
def _extract_audio(multimodal_output: dict) -> torch.Tensor:
|
||||
"""Extract the final complete audio tensor from multimodal output."""
|
||||
assert isinstance(multimodal_output, (dict, Mapping)), f"Expected dict/Mapping, got {type(multimodal_output)}"
|
||||
|
||||
# The talker emits delta chunks; the output processor accumulates them
|
||||
# under "model_outputs" ("audio" kept for backwards compat).
|
||||
audio = multimodal_output.get("model_outputs")
|
||||
if audio is None:
|
||||
audio = multimodal_output.get("audio")
|
||||
assert audio is not None, f"No audio key, got {list(multimodal_output.keys())}"
|
||||
|
||||
if isinstance(audio, list):
|
||||
valid = [torch.as_tensor(x).float().cpu().reshape(-1) for x in audio if x is not None]
|
||||
assert valid, "No valid audio tensors in output list"
|
||||
audio = torch.cat(valid, dim=0) if len(valid) > 1 else valid[0]
|
||||
|
||||
assert isinstance(audio, torch.Tensor), f"Expected Tensor, got {type(audio)}"
|
||||
return audio.float().cpu().reshape(-1)
|
||||
|
||||
|
||||
@pytest.mark.slow
|
||||
@pytest.mark.tts
|
||||
@hardware_test(res={"cuda": "L4"}, num_cards=1)
|
||||
def test_dots_tts_zero_shot_001(omni_runner: OmniRunner) -> None:
|
||||
"""Zero-shot synthesis produces audio of a plausible duration."""
|
||||
prompt = _build_prompt(omni_runner, "Hello, this is a test of dots TTS running on vLLM Omni.")
|
||||
|
||||
outputs = omni_runner.omni.generate([prompt])
|
||||
assert len(outputs) == 1
|
||||
|
||||
audio = _extract_audio(outputs[0].outputs[0].multimodal_output)
|
||||
duration_s = audio.shape[0] / SAMPLE_RATE
|
||||
assert 0.5 < duration_s < 30.0, f"Audio duration out of range: {duration_s:.2f}s"
|
||||
assert torch.isfinite(audio).all(), "Audio contains NaN/Inf"
|
||||
assert audio.abs().max() > 1e-3, "Audio is silent"
|
||||
|
||||
|
||||
@pytest.mark.slow
|
||||
@pytest.mark.tts
|
||||
@hardware_test(res={"cuda": "L4"}, num_cards=1)
|
||||
def test_dots_tts_prefill_decode_mixed_batch_002(omni_runner: OmniRunner) -> None:
|
||||
"""Mixed prefill+decode batches must keep per-request rows aligned.
|
||||
|
||||
``compute_logits`` fills ``logits[i]`` positionally from
|
||||
``_results_queue``, so every request in the batch has to push exactly one
|
||||
entry per step, prefills included. When the prefill branch pushed nothing,
|
||||
a shorter request's stop signal could be read into another request's row.
|
||||
Regression guard for that pairing (PR #4765 review).
|
||||
"""
|
||||
long_text = (
|
||||
"This is a deliberately long sentence that stays in the decode phase "
|
||||
"for many steps, so the shorter requests behind it keep entering "
|
||||
"prefill alongside it and reproduce the mixed batch pattern."
|
||||
)
|
||||
short_texts = ["Hello one.", "Hello two.", "Hello three.", "Hello four."]
|
||||
prompts = [_build_prompt(omni_runner, long_text)] + [_build_prompt(omni_runner, t) for t in short_texts]
|
||||
|
||||
outputs = omni_runner.omni.generate(prompts)
|
||||
assert len(outputs) == len(prompts)
|
||||
|
||||
for i, out in enumerate(outputs):
|
||||
audio = _extract_audio(out.outputs[0].multimodal_output)
|
||||
duration_s = audio.shape[0] / SAMPLE_RATE
|
||||
assert 0.1 < duration_s < 30.0, f"Request {i} audio duration out of range: {duration_s:.2f}s"
|
||||
|
||||
|
||||
@pytest.mark.slow
|
||||
@pytest.mark.tts
|
||||
@hardware_test(res={"cuda": "L4"}, num_cards=1)
|
||||
def test_dots_tts_deterministic_flow_matching_noise_003(omni_runner: OmniRunner) -> None:
|
||||
"""The same text twice must yield the same audio.
|
||||
|
||||
The DiT flow-matching noise is drawn from a per-request generator seeded
|
||||
from ``blake2b(seed:request_key:noise_step)`` rather than the global CUDA
|
||||
RNG. Drawing from the global RNG made output non-reproducible and let
|
||||
concurrent requests perturb each other's noise streams (PR #4765 review).
|
||||
"""
|
||||
text = "Reading aloud every evening helps children build a lasting love of language."
|
||||
|
||||
first = _extract_audio(
|
||||
omni_runner.omni.generate([_build_prompt(omni_runner, text)])[0].outputs[0].multimodal_output
|
||||
)
|
||||
second = _extract_audio(
|
||||
omni_runner.omni.generate([_build_prompt(omni_runner, text)])[0].outputs[0].multimodal_output
|
||||
)
|
||||
|
||||
assert first.shape == second.shape, f"Length differs across runs: {first.shape} vs {second.shape}"
|
||||
assert torch.allclose(first, second, atol=1e-4), "Audio differs across runs; flow-matching noise is not seeded"
|
||||
@@ -1,374 +0,0 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
"""
|
||||
E2E offline smoke tests for Dynin-Omni.
|
||||
|
||||
- model: "snu-aidas/Dynin-Omni"
|
||||
- stage config: vllm_omni/deploy/dynin_omni_ci.yaml
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
import numpy as np
|
||||
import pytest
|
||||
import torch
|
||||
from transformers import AutoTokenizer
|
||||
|
||||
from tests.helpers.mark import hardware_test
|
||||
from tests.helpers.stage_config import get_deploy_config_path
|
||||
|
||||
os.environ["VLLM_WORKER_MULTIPROC_METHOD"] = "spawn"
|
||||
|
||||
_REPO_ROOT = Path(__file__).resolve().parents[3]
|
||||
_DEFAULT_DYNIN_CONFIG_PATH: Path | None = None
|
||||
_DEFAULT_STAGE_CONFIG_PATH = Path(get_deploy_config_path("dynin_omni_ci.yaml"))
|
||||
|
||||
models = ["snu-aidas/Dynin-Omni"]
|
||||
stage_configs = [str(_DEFAULT_STAGE_CONFIG_PATH)]
|
||||
test_params = [(model, stage_config, {"trust_remote_code": True}) for model in models for stage_config in stage_configs]
|
||||
|
||||
DYNIN_CONFIG_PATH = str(_DEFAULT_DYNIN_CONFIG_PATH) if _DEFAULT_DYNIN_CONFIG_PATH is not None else None
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.slow,
|
||||
pytest.mark.omni,
|
||||
pytest.mark.parametrize("omni_runner", test_params, indirect=True),
|
||||
]
|
||||
|
||||
|
||||
# prompting util
|
||||
def _build_mmu_prompt(tokenizer: Any, question: str, dynin_config_path: str | None) -> dict[str, Any]:
|
||||
encoded = tokenizer(question, return_tensors="pt", add_special_tokens=True)
|
||||
token_ids = [int(v) for v in encoded["input_ids"][0].tolist()]
|
||||
attention_mask = [int(v) for v in encoded["attention_mask"][0].tolist()]
|
||||
additional_information: dict[str, Any] = {
|
||||
"task": ["mmu"],
|
||||
"detok_id": [0],
|
||||
"prompt_length": [len(token_ids)],
|
||||
"attention_mask": [attention_mask],
|
||||
"max_new_tokens": [64],
|
||||
"steps": [64],
|
||||
"block_length": [16],
|
||||
"temperature": [0.0],
|
||||
}
|
||||
if dynin_config_path:
|
||||
additional_information["dynin_config_path"] = [str(dynin_config_path)]
|
||||
return {
|
||||
"prompt_token_ids": token_ids,
|
||||
"additional_information": additional_information,
|
||||
"modalities": ["text"],
|
||||
}
|
||||
|
||||
|
||||
def _build_mmu_multimodal_prompt(
|
||||
tokenizer: Any,
|
||||
question: str,
|
||||
dynin_config_path: str | None,
|
||||
*,
|
||||
image: Any | None = None,
|
||||
audio: tuple[np.ndarray, int] | None = None,
|
||||
) -> dict[str, Any]:
|
||||
if image is None and audio is None:
|
||||
raise ValueError("At least one multimodal input (image or audio) must be provided.")
|
||||
|
||||
prefix_chunks: list[str] = []
|
||||
mm_data: dict[str, Any] = {}
|
||||
if image is not None:
|
||||
prefix_chunks.append("<|soi|><|image|><|eoi|>")
|
||||
mm_data["image"] = image
|
||||
if audio is not None:
|
||||
prefix_chunks.append("<|soa|><|audio|><|eoa|>")
|
||||
mm_data["audio"] = audio
|
||||
|
||||
prefixed_question = " ".join(prefix_chunks + [question]).strip()
|
||||
prompt = _build_mmu_prompt(
|
||||
tokenizer=tokenizer,
|
||||
question=prefixed_question,
|
||||
dynin_config_path=dynin_config_path,
|
||||
)
|
||||
prompt["multi_modal_data"] = mm_data
|
||||
prompt["modalities"] = ["text"]
|
||||
return prompt
|
||||
|
||||
|
||||
def _generate_synthetic_image(width: int = 224, height: int = 224) -> np.ndarray:
|
||||
x = np.linspace(0, 255, width, dtype=np.uint8)
|
||||
y = np.linspace(0, 255, height, dtype=np.uint8)[:, None]
|
||||
red = np.tile(x, (height, 1))
|
||||
green = np.tile(y, (1, width))
|
||||
blue = ((red.astype(np.uint16) + green.astype(np.uint16)) // 2).astype(np.uint8)
|
||||
return np.stack([red, green, blue], axis=-1)
|
||||
|
||||
|
||||
def _generate_synthetic_audio(duration_s: int = 5, sample_rate: int = 48_000) -> tuple[np.ndarray, int]:
|
||||
t = np.linspace(0, duration_s, int(sample_rate * duration_s), endpoint=False, dtype=np.float32)
|
||||
waveform = 0.1 * np.sin(2.0 * np.pi * 440.0 * t)
|
||||
return waveform.astype(np.float32), sample_rate
|
||||
|
||||
|
||||
# prompting util
|
||||
def _build_t2s_decode_prompt(dynin_config_path: str | None) -> dict[str, Any]:
|
||||
# Bypass stage-0 generation and directly validate token->audio decode path.
|
||||
generated_audio_token_ids = [int(v) for v in ([10, 11, 12, 13, 14] * 32)]
|
||||
additional_information: dict[str, Any] = {
|
||||
"task": ["t2s"],
|
||||
"detok_id": [1],
|
||||
"generated_token_ids": [generated_audio_token_ids],
|
||||
"audio_codebook_size": [4096],
|
||||
}
|
||||
if dynin_config_path:
|
||||
additional_information["dynin_config_path"] = [str(dynin_config_path)]
|
||||
return {
|
||||
"prompt_token_ids": [0],
|
||||
"additional_information": additional_information,
|
||||
"modalities": ["audio"],
|
||||
}
|
||||
|
||||
|
||||
# prompting util
|
||||
def _build_t2i_decode_prompt(dynin_config_path: str | None) -> dict[str, Any]:
|
||||
# Bypass stage-0 generation and directly validate token->image decode path.
|
||||
# MAGVIT decode path expects a square token grid; 1024 tokens -> 32x32.
|
||||
generated_image_token_ids = [int(v) for v in ([10, 11, 12, 13, 14, 15, 16, 17] * 128)]
|
||||
additional_information: dict[str, Any] = {
|
||||
"task": ["t2i"],
|
||||
"detok_id": [2],
|
||||
"generated_token_ids": [generated_image_token_ids],
|
||||
"codebook_size": [8192],
|
||||
}
|
||||
if dynin_config_path:
|
||||
additional_information["dynin_config_path"] = [str(dynin_config_path)]
|
||||
return {
|
||||
"prompt_token_ids": [0],
|
||||
"additional_information": additional_information,
|
||||
"modalities": ["image"],
|
||||
}
|
||||
|
||||
|
||||
def _configure_dynin_config_env() -> None:
|
||||
if DYNIN_CONFIG_PATH:
|
||||
os.environ["DYNIN_CONFIG_PATH"] = str(DYNIN_CONFIG_PATH)
|
||||
else:
|
||||
os.environ.pop("DYNIN_CONFIG_PATH", None)
|
||||
|
||||
|
||||
def _is_finished_request_output(request_output: Any) -> bool:
|
||||
if request_output is None:
|
||||
return False
|
||||
req_list = request_output if isinstance(request_output, list) else [request_output]
|
||||
for req in req_list:
|
||||
if req is not None and bool(getattr(req, "finished", False)):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def _find_stage_output(outputs: list[Any], output_type: str) -> Any | None:
|
||||
matched = [
|
||||
stage_output for stage_output in outputs if getattr(stage_output, "final_output_type", None) == output_type
|
||||
]
|
||||
if not matched:
|
||||
return None
|
||||
|
||||
# Prefer the latest finished chunk to avoid picking an intermediate stream output.
|
||||
for stage_output in reversed(matched):
|
||||
if _is_finished_request_output(stage_output):
|
||||
return stage_output
|
||||
return matched[-1]
|
||||
|
||||
|
||||
def _to_token_list(value: Any) -> list[int]:
|
||||
if value is None:
|
||||
return []
|
||||
if hasattr(value, "detach"):
|
||||
value = value.detach()
|
||||
if hasattr(value, "cpu"):
|
||||
value = value.cpu()
|
||||
if hasattr(value, "flatten"):
|
||||
value = value.flatten().tolist()
|
||||
if isinstance(value, tuple):
|
||||
value = list(value)
|
||||
if not isinstance(value, list):
|
||||
return []
|
||||
out: list[int] = []
|
||||
for token in value:
|
||||
if isinstance(token, bool):
|
||||
continue
|
||||
try:
|
||||
out.append(int(token))
|
||||
except Exception:
|
||||
continue
|
||||
return out
|
||||
|
||||
|
||||
def _extract_text(stage_output: Any, tokenizer: Any | None = None) -> str:
|
||||
request_output = stage_output
|
||||
if request_output is None:
|
||||
return ""
|
||||
req_list = request_output if isinstance(request_output, list) else [request_output]
|
||||
for req in req_list:
|
||||
completions = getattr(req, "outputs", None) or []
|
||||
if not completions:
|
||||
continue
|
||||
completion = completions[0]
|
||||
mm_out = (
|
||||
getattr(completion, "multimodal_output", None)
|
||||
or getattr(req, "multimodal_output", None)
|
||||
or getattr(stage_output, "multimodal_output", None)
|
||||
or {}
|
||||
)
|
||||
text = mm_out.get("text")
|
||||
if isinstance(text, list) and text:
|
||||
text = text[-1]
|
||||
if isinstance(text, str) and text.strip():
|
||||
return text.strip()
|
||||
if tokenizer is not None:
|
||||
for key in ("text_tokens", "token_ids"):
|
||||
token_ids = _to_token_list(mm_out.get(key))
|
||||
if not token_ids:
|
||||
continue
|
||||
decoded = tokenizer.decode(token_ids, skip_special_tokens=True)
|
||||
if isinstance(decoded, str) and decoded.strip():
|
||||
return decoded.strip()
|
||||
fallback = getattr(completion, "text", None)
|
||||
if isinstance(fallback, str) and fallback.strip():
|
||||
return fallback.strip()
|
||||
return ""
|
||||
|
||||
|
||||
def _extract_audio(stage_output: Any) -> Any | None:
|
||||
request_output = stage_output
|
||||
if request_output is None:
|
||||
return None
|
||||
req_list = request_output if isinstance(request_output, list) else [request_output]
|
||||
for req in req_list:
|
||||
completions = getattr(req, "outputs", None) or []
|
||||
if not completions:
|
||||
continue
|
||||
completion = completions[0]
|
||||
mm_out = getattr(completion, "multimodal_output", None) or {}
|
||||
if "audio" in mm_out:
|
||||
return mm_out["audio"]
|
||||
return None
|
||||
|
||||
|
||||
def _extract_image(stage_output: Any) -> Any | None:
|
||||
request_output = stage_output
|
||||
if request_output is None:
|
||||
return None
|
||||
req_list = request_output if isinstance(request_output, list) else [request_output]
|
||||
for req in req_list:
|
||||
completions = getattr(req, "outputs", None) or []
|
||||
if not completions:
|
||||
continue
|
||||
completion = completions[0]
|
||||
mm_out = getattr(completion, "multimodal_output", None) or {}
|
||||
if "image" in mm_out:
|
||||
return mm_out["image"]
|
||||
return None
|
||||
|
||||
|
||||
def _numel(value: Any) -> int:
|
||||
if value is None:
|
||||
return 0
|
||||
if isinstance(value, torch.Tensor):
|
||||
return int(value.numel())
|
||||
shape = getattr(value, "shape", None)
|
||||
if shape is not None:
|
||||
try:
|
||||
total = 1
|
||||
for dim in shape:
|
||||
total *= int(dim)
|
||||
return int(total)
|
||||
except Exception:
|
||||
pass
|
||||
if isinstance(value, (list, tuple)):
|
||||
return len(value)
|
||||
return 0
|
||||
|
||||
|
||||
@hardware_test(res={"cuda": "H100", "rocm": "MI325"})
|
||||
def test_dynin_t2i_decode_to_image(omni_runner) -> None:
|
||||
_configure_dynin_config_env()
|
||||
prompt = _build_t2i_decode_prompt(dynin_config_path=DYNIN_CONFIG_PATH)
|
||||
|
||||
outputs = omni_runner.generate([prompt])
|
||||
|
||||
image_output = _find_stage_output(outputs, "image")
|
||||
assert image_output is not None
|
||||
image_value = _extract_image(image_output)
|
||||
assert image_value is not None
|
||||
assert _numel(image_value) > 0
|
||||
|
||||
|
||||
@hardware_test(res={"cuda": "H100", "rocm": "MI325"})
|
||||
def test_dynin_mmu_to_text(omni_runner) -> None:
|
||||
_configure_dynin_config_env()
|
||||
tokenizer = AutoTokenizer.from_pretrained(omni_runner.model_name, trust_remote_code=True)
|
||||
prompt = _build_mmu_prompt(
|
||||
tokenizer=tokenizer,
|
||||
question="What is 2 + 2? Answer in one short sentence.",
|
||||
dynin_config_path=DYNIN_CONFIG_PATH,
|
||||
)
|
||||
|
||||
outputs = omni_runner.generate([prompt])
|
||||
|
||||
text_output = _find_stage_output(outputs, "text")
|
||||
assert text_output is not None
|
||||
text_content = _extract_text(text_output, tokenizer=tokenizer)
|
||||
assert text_content
|
||||
|
||||
|
||||
@hardware_test(res={"cuda": "H100", "rocm": "MI325"})
|
||||
def test_dynin_image_to_text(omni_runner) -> None:
|
||||
_configure_dynin_config_env()
|
||||
tokenizer = AutoTokenizer.from_pretrained(omni_runner.model_name, trust_remote_code=True)
|
||||
prompt = _build_mmu_multimodal_prompt(
|
||||
tokenizer=tokenizer,
|
||||
question="Describe the image briefly in one sentence.",
|
||||
dynin_config_path=DYNIN_CONFIG_PATH,
|
||||
image=_generate_synthetic_image(),
|
||||
)
|
||||
|
||||
outputs = omni_runner.generate([prompt])
|
||||
|
||||
text_output = _find_stage_output(outputs, "text")
|
||||
assert text_output is not None
|
||||
text_content = _extract_text(text_output, tokenizer=tokenizer)
|
||||
assert text_content
|
||||
|
||||
|
||||
@hardware_test(res={"cuda": "H100", "rocm": "MI325"})
|
||||
def test_dynin_speech_to_text(omni_runner) -> None:
|
||||
_configure_dynin_config_env()
|
||||
tokenizer = AutoTokenizer.from_pretrained(omni_runner.model_name, trust_remote_code=True)
|
||||
prompt = _build_mmu_multimodal_prompt(
|
||||
tokenizer=tokenizer,
|
||||
question="Transcribe the audio briefly in one sentence.",
|
||||
dynin_config_path=DYNIN_CONFIG_PATH,
|
||||
audio=_generate_synthetic_audio(),
|
||||
)
|
||||
|
||||
outputs = omni_runner.generate([prompt])
|
||||
|
||||
text_output = _find_stage_output(outputs, "text")
|
||||
assert text_output is not None
|
||||
text_content = _extract_text(text_output, tokenizer=tokenizer)
|
||||
assert text_content
|
||||
|
||||
|
||||
@hardware_test(res={"cuda": "H100", "rocm": "MI325"})
|
||||
def test_dynin_t2s_decode_to_audio(omni_runner) -> None:
|
||||
_configure_dynin_config_env()
|
||||
prompt = _build_t2s_decode_prompt(dynin_config_path=DYNIN_CONFIG_PATH)
|
||||
|
||||
outputs = omni_runner.generate([prompt])
|
||||
|
||||
audio_output = _find_stage_output(outputs, "audio")
|
||||
assert audio_output is not None
|
||||
audio_value = _extract_audio(audio_output)
|
||||
assert audio_value is not None
|
||||
assert _numel(audio_value) > 0
|
||||
@@ -1,91 +0,0 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
"""
|
||||
E2E Online expansion tests for dots.tts(text-only).
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.helpers.mark import hardware_test
|
||||
from tests.helpers.runtime import OmniServerParams
|
||||
from tests.helpers.stage_config import get_deploy_config_path
|
||||
|
||||
pytestmark = [pytest.mark.full_model, pytest.mark.tts]
|
||||
|
||||
os.environ["VLLM_WORKER_MULTIPROC_METHOD"] = "spawn"
|
||||
|
||||
MODEL = "dots-studio/dots.tts-soar"
|
||||
DEFAULT_AUDIO_SPEECH_TIMEOUT_S = 300.0
|
||||
_MIN_AUDIO_BYTES = 40_000
|
||||
MAX_CONCURRENT = 4
|
||||
|
||||
|
||||
def get_prompt(prompt_type="text"):
|
||||
prompts = {
|
||||
"text": "The weather is nice today, perfect for a walk in the park.",
|
||||
}
|
||||
return prompts.get(prompt_type, prompts["text"])
|
||||
|
||||
|
||||
tts_server_params = [
|
||||
pytest.param(
|
||||
OmniServerParams(
|
||||
model=MODEL,
|
||||
stage_config_path=get_deploy_config_path("dots_tts.yaml"),
|
||||
server_args=["--trust-remote-code", "--disable-log-stats"],
|
||||
),
|
||||
id="dots_tts",
|
||||
)
|
||||
]
|
||||
|
||||
|
||||
@hardware_test(res={"cuda": "L4"}, num_cards=1)
|
||||
@pytest.mark.parametrize("omni_server", tts_server_params, indirect=True)
|
||||
def test_text_only_streaming_001(omni_server, openai_client) -> None:
|
||||
"""
|
||||
Test text-only text-to-audio via OpenAI API.
|
||||
Deploy Setting: dots_tts.yaml
|
||||
Input Modal: text
|
||||
Output Modal: audio
|
||||
Input Setting: stream=True
|
||||
Datasets: few requests (max_num_seqs=4)
|
||||
"""
|
||||
request_config = {
|
||||
"model": omni_server.model,
|
||||
"input": get_prompt(),
|
||||
"stream": True,
|
||||
"stream_format": "audio",
|
||||
"timeout": DEFAULT_AUDIO_SPEECH_TIMEOUT_S,
|
||||
"response_format": "wav",
|
||||
"voice": "default",
|
||||
"min_audio_bytes": _MIN_AUDIO_BYTES,
|
||||
}
|
||||
openai_client.send_audio_speech_request(request_config, request_num=MAX_CONCURRENT)
|
||||
|
||||
|
||||
@hardware_test(res={"cuda": "L4"}, num_cards=1)
|
||||
@pytest.mark.parametrize("omni_server", tts_server_params, indirect=True)
|
||||
def test_text_only_nonstreaming_pcm_001(omni_server, openai_client) -> None:
|
||||
"""
|
||||
Test text-only non-stream PCM output via OpenAI API.
|
||||
Deploy Setting: dots_tts.yaml
|
||||
Input Modal: text
|
||||
Output Modal: audio (pcm)
|
||||
Input Setting: stream=False
|
||||
Datasets: single request
|
||||
"""
|
||||
request_config = {
|
||||
"model": omni_server.model,
|
||||
"input": get_prompt(),
|
||||
"response_format": "pcm",
|
||||
"stream": False,
|
||||
"timeout": DEFAULT_AUDIO_SPEECH_TIMEOUT_S,
|
||||
"voice": "default",
|
||||
"min_audio_bytes": _MIN_AUDIO_BYTES,
|
||||
"min_hnr_db": -2.0,
|
||||
# dots.tts-soar emits native 48 kHz PCM, which has no rate header.
|
||||
"expected_sample_rate": 48_000,
|
||||
}
|
||||
openai_client.send_audio_speech_request(request_config)
|
||||
@@ -1,99 +0,0 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
|
||||
"""
|
||||
Example online tests for Dynin-Omni model.
|
||||
"""
|
||||
|
||||
import base64
|
||||
import os
|
||||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
from vllm.assets.image import ImageAsset
|
||||
|
||||
from tests.helpers.mark import hardware_test
|
||||
from tests.helpers.runtime import OmniServerParams
|
||||
from tests.helpers.stage_config import get_deploy_config_path
|
||||
|
||||
pytestmark = [pytest.mark.slow, pytest.mark.omni]
|
||||
|
||||
os.environ["VLLM_WORKER_MULTIPROC_METHOD"] = "spawn"
|
||||
|
||||
MODEL = "snu-aidas/Dynin-Omni"
|
||||
STAGE_CONFIG = get_deploy_config_path("dynin_omni_ci.yaml")
|
||||
|
||||
T2I_PROMPT = "A high quality detailed living room interior photo."
|
||||
T2S_PROMPT = "Please read this sentence naturally: Hello from online serving."
|
||||
I2I_PROMPT = "Transform this outdoor nature boardwalk scene into a painting style with vivid colors."
|
||||
|
||||
TEST_PARAMS = [
|
||||
OmniServerParams(
|
||||
model=MODEL,
|
||||
stage_config_path=STAGE_CONFIG,
|
||||
stage_init_timeout=600,
|
||||
server_args=["--trust-remote-code"],
|
||||
)
|
||||
]
|
||||
_STAGE_COUNT = 3
|
||||
_I2I_STAGE_SAMPLING = {"max_tokens": 1, "temperature": 0.0, "top_p": 1.0, "detokenize": False}
|
||||
|
||||
|
||||
def _build_t2i_messages(prompt: str) -> list[dict]:
|
||||
return [{"role": "user", "content": [{"type": "text", "text": f"<|t2i|> {prompt}"}]}]
|
||||
|
||||
|
||||
def _build_t2s_messages(prompt: str) -> list[dict]:
|
||||
return [{"role": "user", "content": [{"type": "text", "text": f"<|t2s|> {prompt}"}]}]
|
||||
|
||||
|
||||
def _build_i2i_messages(prompt: str) -> list[dict]:
|
||||
input_image = ImageAsset("2560px-Gfp-wisconsin-madison-the-nature-boardwalk").pil_image.convert("RGB")
|
||||
buffer = BytesIO()
|
||||
input_image.save(buffer, format="JPEG")
|
||||
image_b64 = base64.b64encode(buffer.getvalue()).decode("utf-8")
|
||||
return [
|
||||
{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{"type": "text", "text": f"<|i2i|> {prompt}"},
|
||||
{"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{image_b64}"}},
|
||||
],
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@hardware_test(res={"cuda": "H100", "rocm": "MI325"})
|
||||
@pytest.mark.parametrize("omni_server", TEST_PARAMS, indirect=True)
|
||||
def test_send_i2i_request_001(omni_server, online_client) -> None:
|
||||
request_config = {
|
||||
"model": omni_server.model,
|
||||
"messages": _build_i2i_messages(I2I_PROMPT),
|
||||
"modalities": ["image"],
|
||||
"extra_body": {
|
||||
"sampling_params_list": [dict(_I2I_STAGE_SAMPLING) for _ in range(_STAGE_COUNT)],
|
||||
},
|
||||
}
|
||||
online_client.send_diffusion_request(request_config)
|
||||
|
||||
|
||||
@hardware_test(res={"cuda": "H100", "rocm": "MI325"})
|
||||
@pytest.mark.parametrize("omni_server", TEST_PARAMS, indirect=True)
|
||||
def test_send_t2i_request_001(omni_server, online_client) -> None:
|
||||
request_config = {
|
||||
"model": omni_server.model,
|
||||
"messages": _build_t2i_messages(T2I_PROMPT),
|
||||
"modalities": ["image"],
|
||||
}
|
||||
online_client.send_diffusion_request(request_config)
|
||||
|
||||
|
||||
@hardware_test(res={"cuda": "H100", "rocm": "MI325"})
|
||||
@pytest.mark.parametrize("omni_server", TEST_PARAMS, indirect=True)
|
||||
def test_send_t2s_request_001(omni_server, online_client) -> None:
|
||||
request_config = {
|
||||
"model": omni_server.model,
|
||||
"messages": _build_t2s_messages(T2S_PROMPT),
|
||||
"modalities": ["audio"],
|
||||
"audio_ref_text": T2S_PROMPT,
|
||||
}
|
||||
online_client.send_omni_request(request_config)
|
||||
@@ -539,7 +539,7 @@ def test_tensor_parallel_size_none_is_handled():
|
||||
engine_args = OmegaConf.create({"stage_id": 0, "engine_args": {"tensor_parallel_size": None}})
|
||||
args = build_engine_args_dict(
|
||||
engine_args,
|
||||
model="snu-aidas/Dynin-Omni",
|
||||
model="Qwen/Qwen2-VL-2B-Instruct",
|
||||
)
|
||||
assert isinstance(args, dict)
|
||||
assert "tensor_parallel_size" not in args
|
||||
@@ -5035,89 +5035,6 @@ class TestMingFlashOmniTTSServing:
|
||||
assert prompt["additional_information"]["voice_name"] == "test"
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def dots_tts_server(mocker: MockerFixture):
|
||||
mocker.patch(
|
||||
"vllm_omni.entrypoints.openai.tts_adapters.base.load_supported_speakers",
|
||||
return_value=set(),
|
||||
)
|
||||
mocker.patch(
|
||||
"vllm_omni.entrypoints.openai.tts_adapters.base.load_codec_frame_rate",
|
||||
return_value=None,
|
||||
)
|
||||
|
||||
mock_engine_client = mocker.MagicMock()
|
||||
mock_engine_client.errored = False
|
||||
mock_engine_client.model_config = mocker.MagicMock(
|
||||
model="dots-studio/dots.tts-soar",
|
||||
)
|
||||
mock_engine_client.default_sampling_params_list = [
|
||||
SimpleNamespace(max_tokens=2048, min_tokens=None, extra_args=None)
|
||||
]
|
||||
mock_engine_client.tts_batch_max_items = 32
|
||||
mock_engine_client.generate = mocker.MagicMock(return_value="generator")
|
||||
mock_engine_client.stage_configs = [
|
||||
SimpleNamespace(
|
||||
engine_args=SimpleNamespace(model_stage="latent_generator", model_arch="DotsTTSForConditionalGeneration"),
|
||||
tts_args={},
|
||||
)
|
||||
]
|
||||
|
||||
mock_models = mocker.MagicMock()
|
||||
mock_models.is_base_model.return_value = True
|
||||
|
||||
return OmniOpenAIServingSpeech(
|
||||
engine_client=mock_engine_client,
|
||||
models=mock_models,
|
||||
request_logger=mocker.MagicMock(),
|
||||
)
|
||||
|
||||
|
||||
class TestDotsTTSServing:
|
||||
def test_dots_tts_prompt_validation(self, dots_tts_server):
|
||||
request = OpenAICreateSpeechRequest(input="Hello", ref_text="Reference transcript")
|
||||
error = dots_tts_server._validate_tts_request(request)
|
||||
assert error is not None
|
||||
assert "ref_text" in error
|
||||
|
||||
request = OpenAICreateSpeechRequest(input="Hello", ref_audio="data:audio/wav;base64,abc")
|
||||
error = dots_tts_server._validate_tts_request(request)
|
||||
assert error is not None
|
||||
assert "ref_audio" in error
|
||||
|
||||
request = OpenAICreateSpeechRequest(input="Hello", voice="test")
|
||||
error = dots_tts_server._validate_tts_request(request)
|
||||
assert error is not None
|
||||
assert "voice" in error
|
||||
|
||||
request = OpenAICreateSpeechRequest(input="Hello", speaker_embedding=[1, 2, 3])
|
||||
error = dots_tts_server._validate_tts_request(request)
|
||||
assert error is not None
|
||||
assert "speaker_embedding" in error
|
||||
|
||||
request = OpenAICreateSpeechRequest(input="Hello", x_vector_only_mode=True)
|
||||
error = dots_tts_server._validate_tts_request(request)
|
||||
assert error is not None
|
||||
assert "x_vector_only_mode" in error
|
||||
|
||||
def test_dots_tts_adapter_awaits_async_prompt_builder(self, dots_tts_server, mocker: MockerFixture):
|
||||
build_prompt_async = mocker.patch.object(
|
||||
dots_tts_server._adapter,
|
||||
"_build_prompt_async",
|
||||
new=mocker.AsyncMock(return_value={"prompt_token_ids": [1, 2, 3]}),
|
||||
)
|
||||
request = OpenAICreateSpeechRequest(input="Hello")
|
||||
asyncio.run(dots_tts_server._prepare_speech_generation(request))
|
||||
build_prompt_async.assert_awaited_once_with("Hello")
|
||||
|
||||
def test_dots_tts_adapter_apply_sampling_overrides(self, dots_tts_server, mocker: MockerFixture):
|
||||
mocker.patch.object(dots_tts_server._adapter, "build", return_value=PreparedRequest(prompt="Hello"))
|
||||
request = OpenAICreateSpeechRequest(input="Hello", max_new_tokens=10)
|
||||
asyncio.run(dots_tts_server._prepare_speech_generation(request))
|
||||
sampling_params_list = dots_tts_server.engine_client.generate.call_args.kwargs["sampling_params_list"]
|
||||
assert sampling_params_list[0].max_tokens == 10
|
||||
|
||||
|
||||
class TestTTSAsyncOffloading:
|
||||
"""Tests for event-loop-safe offloading of blocking TTS operations."""
|
||||
|
||||
|
||||
@@ -71,7 +71,6 @@ EXPECTED_MODEL_TYPES = {
|
||||
"indextts2",
|
||||
"indextts2_5",
|
||||
"gepard",
|
||||
"dots_tts",
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -263,7 +263,6 @@ def test_arch_matching_is_a_fallback_not_an_override():
|
||||
|
||||
def test_shared_latent_generator_resolves_by_architecture_priority():
|
||||
assert detect_tts_model_type("latent_generator", "VoxCPM2TalkerForConditionalGeneration") == "voxcpm2"
|
||||
assert detect_tts_model_type("latent_generator", "DotsTTSForConditionalGeneration") == "dots_tts"
|
||||
|
||||
|
||||
def test_stage_keys_cover_legacy_stage_set():
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
@@ -1,137 +0,0 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
"""Regression tests for the dots.tts talker's stop-signal pairing and
|
||||
per-request state lifecycle.
|
||||
|
||||
Pure-CPU tests on a bare talker (``__new__`` + the handful of attributes
|
||||
the methods under test read) — no weights, no GPU, no engine. Mirrors
|
||||
tests/model_executor/models/voxcpm2/test_talker_state_eviction.py.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import functools
|
||||
from types import SimpleNamespace
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = [pytest.mark.core_model, pytest.mark.cpu]
|
||||
|
||||
|
||||
torch = pytest.importorskip("torch")
|
||||
|
||||
_VOCAB_SIZE = 151672
|
||||
|
||||
|
||||
@functools.lru_cache(maxsize=1)
|
||||
def _dots_tts_talker_mod():
|
||||
"""Defer talker import (pulls vLLM model_executor) until first use."""
|
||||
from vllm_omni.model_executor.models.dots_tts.dots_tts_talker import (
|
||||
DotsTTSForConditionalGeneration,
|
||||
_RequestState,
|
||||
)
|
||||
|
||||
return DotsTTSForConditionalGeneration, _RequestState
|
||||
|
||||
|
||||
def _make_bare_talker():
|
||||
DotsTTSForConditionalGeneration, _ = _dots_tts_talker_mod()
|
||||
talker = DotsTTSForConditionalGeneration.__new__(DotsTTSForConditionalGeneration)
|
||||
talker.config = SimpleNamespace(vocab_size=_VOCAB_SIZE)
|
||||
talker._active_states = {}
|
||||
talker._pending_requests = []
|
||||
talker._results_queue = []
|
||||
talker._audio_queue = []
|
||||
talker._deferred_cleanup_ids = set()
|
||||
talker._beta_trace = False
|
||||
return talker
|
||||
|
||||
|
||||
def _add_state(talker, req_id: str, *, is_stopping: bool = False):
|
||||
_, _RequestState = _dots_tts_talker_mod()
|
||||
state = _RequestState(request_id=req_id)
|
||||
state.prefill_completed = True
|
||||
state.is_stopping = is_stopping
|
||||
talker._active_states[req_id] = state
|
||||
return state
|
||||
|
||||
|
||||
def _hidden(bsz: int) -> torch.Tensor:
|
||||
return torch.zeros(bsz, 1536, dtype=torch.float32)
|
||||
|
||||
|
||||
class TestComputeLogitsPairing:
|
||||
"""compute_logits pairs _results_queue entries with batch rows
|
||||
positionally, so every request must push exactly one entry per step —
|
||||
including prefills, which push a (req_id, None) placeholder."""
|
||||
|
||||
def test_mixed_batch_prefill_placeholder_keeps_rows_aligned(self) -> None:
|
||||
talker = _make_bare_talker()
|
||||
_add_state(talker, "prefill-req")
|
||||
decode_state = _add_state(talker, "decode-req", is_stopping=True)
|
||||
decode_state.precomputed_stop_logits = torch.tensor([[0.1, 0.9]])
|
||||
|
||||
# Row 0 is the prefill (None placeholder), row 1 the stopping decode.
|
||||
talker._results_queue = [
|
||||
("prefill-req", None),
|
||||
("decode-req", torch.tensor([[0.1, 0.9]])),
|
||||
]
|
||||
logits = talker.compute_logits(_hidden(2))
|
||||
|
||||
assert logits.shape == (2, _VOCAB_SIZE)
|
||||
# Prefill row: forced continue.
|
||||
assert logits[0, 0].item() == 1.0
|
||||
assert logits[0, 1].item() == float("-inf")
|
||||
# Stopping decode row: stop slot wins.
|
||||
assert logits[1, 1].item() == 1.0
|
||||
assert logits[1, 0].item() == 0.0
|
||||
# Everything else stays masked.
|
||||
assert logits[0, 2].item() == float("-inf")
|
||||
assert logits[1, 2].item() == float("-inf")
|
||||
# Queue drained.
|
||||
assert talker._results_queue == []
|
||||
|
||||
def test_below_threshold_stop_logits_force_continue(self) -> None:
|
||||
"""Raw (continue, stop) softmax must not reach the sampler: a
|
||||
prob_stop in (0.5, 0.8] would flip greedy argmax even though
|
||||
is_stopping stayed False (the 0.8-threshold contract)."""
|
||||
talker = _make_bare_talker()
|
||||
_add_state(talker, "req", is_stopping=False)
|
||||
talker._results_queue = [("req", torch.tensor([[0.3, 0.7]]))]
|
||||
|
||||
logits = talker.compute_logits(_hidden(1))
|
||||
|
||||
assert logits[0, 0].item() == 1.0
|
||||
assert logits[0, 1].item() == float("-inf")
|
||||
|
||||
def test_empty_queue_defaults_to_all_continue(self) -> None:
|
||||
talker = _make_bare_talker()
|
||||
logits = talker.compute_logits(_hidden(3))
|
||||
|
||||
assert torch.all(logits[:, 0] == 1.0)
|
||||
assert torch.all(logits[:, 1] == float("-inf"))
|
||||
|
||||
|
||||
class TestStateEviction:
|
||||
"""on_requests_finished fires BEFORE forward(), so eviction must be
|
||||
deferred to _flush_deferred_cleanup at the end of the step — the
|
||||
finishing request's audio still drains through the current forward."""
|
||||
|
||||
def test_finished_request_survives_until_flush(self) -> None:
|
||||
talker = _make_bare_talker()
|
||||
_add_state(talker, "req-a")
|
||||
_add_state(talker, "req-b")
|
||||
|
||||
talker.on_requests_finished(["req-a"])
|
||||
assert "req-a" in talker._active_states # not evicted yet
|
||||
|
||||
talker._flush_deferred_cleanup()
|
||||
assert "req-a" not in talker._active_states
|
||||
assert "req-b" in talker._active_states
|
||||
assert talker._deferred_cleanup_ids == set()
|
||||
|
||||
def test_unknown_request_id_is_ignored(self) -> None:
|
||||
talker = _make_bare_talker()
|
||||
talker.on_requests_finished(["never-seen"])
|
||||
talker._flush_deferred_cleanup()
|
||||
assert talker._active_states == {}
|
||||
@@ -1,40 +0,0 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
from transformers import PreTrainedModel
|
||||
|
||||
from vllm_omni.model_executor.models.dynin_omni.dynin_omni_token2audio import (
|
||||
_ensure_transformers_tied_weights_compat,
|
||||
)
|
||||
|
||||
pytestmark = [pytest.mark.core_model, pytest.mark.cpu]
|
||||
|
||||
|
||||
def test_transformers_tied_weights_compat(monkeypatch):
|
||||
"""Compat shim must not permanently mutate ``PreTrainedModel``.
|
||||
|
||||
``monkeypatch.delattr(..., raising=False)`` is a no-op undo when the attr
|
||||
was absent. ``_ensure_transformers_tied_weights_compat`` then assigns a
|
||||
read-only ``property`` on the class that later PreTrainedModel subclasses
|
||||
(e.g. qwen3 TTS mask-cache) can trip over with
|
||||
``AttributeError: property ... has no setter``.
|
||||
"""
|
||||
monkeypatch.delattr(PreTrainedModel, "all_tied_weights_keys", raising=False)
|
||||
|
||||
_ensure_transformers_tied_weights_compat()
|
||||
installed = PreTrainedModel.__dict__.get("all_tied_weights_keys")
|
||||
assert installed is not None
|
||||
|
||||
# Re-own the installed descriptor through monkeypatch so teardown always
|
||||
# removes/restores it, even when the attr did not exist before this test.
|
||||
delattr(PreTrainedModel, "all_tied_weights_keys")
|
||||
monkeypatch.setattr(PreTrainedModel, "all_tied_weights_keys", installed, raising=False)
|
||||
|
||||
model = PreTrainedModel.__new__(PreTrainedModel)
|
||||
model._tied_weights_keys = ["decoder.weight"]
|
||||
model._dynamic_tied_weights_keys = {"lm_head.weight": "decoder.weight"}
|
||||
|
||||
assert model.all_tied_weights_keys == {
|
||||
"decoder.weight": None,
|
||||
"lm_head.weight": "decoder.weight",
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
|
||||
"""Unit tests for Qwen3-Omni streaming thinker→talker / talker→codec helpers (PR #2581)."""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -356,7 +356,7 @@ def test_accumulator_concat_default_when_no_replace_keys() -> None:
|
||||
class _StubMixin(OmniConnectorModelRunnerMixin):
|
||||
def __init__(self):
|
||||
self._pending_full_payload_send = {}
|
||||
self._full_payload_replace_keys_cached = frozenset()
|
||||
self._full_payload_replace_keys_cached: frozenset[str] = frozenset()
|
||||
|
||||
stub = _StubMixin()
|
||||
stub.accumulate_full_payload_output(
|
||||
@@ -415,51 +415,6 @@ def test_covo_audio_llm2code2wav_full_payload_smoke() -> None:
|
||||
assert payload["meta"]["finished"].item() is True
|
||||
|
||||
|
||||
def test_dynin_omni_token_only_smoke() -> None:
|
||||
"""Smoke: dynin_omni token-only builders return placeholders."""
|
||||
from vllm_omni.model_executor.stage_input_processors.dynin_omni import (
|
||||
token2text_to_token2image_token_only,
|
||||
)
|
||||
|
||||
class _Out:
|
||||
def __init__(self, tids, mm=None):
|
||||
self.token_ids = tids
|
||||
self.multimodal_output = mm
|
||||
|
||||
class _Wrapper:
|
||||
def __init__(self, tids, mm=None):
|
||||
self.outputs = [_Out(tids, mm)]
|
||||
self.request_id = "r0"
|
||||
|
||||
class _Stage:
|
||||
def __init__(self, outs):
|
||||
self.engine_outputs = outs
|
||||
|
||||
src = [_Wrapper([10, 11, 12])]
|
||||
out = token2text_to_token2image_token_only([_Stage(src)], [0])
|
||||
assert len(out) == 1
|
||||
assert len(out[0]["prompt_token_ids"]) == 3
|
||||
assert out[0]["additional_information"] is None
|
||||
|
||||
|
||||
def test_dynin_omni_full_payload_smoke() -> None:
|
||||
"""Smoke: dynin_omni producer-side payload builder returns nested OmniPayload + carries metadata."""
|
||||
from types import SimpleNamespace
|
||||
|
||||
from vllm_omni.model_executor.stage_input_processors.dynin_omni import (
|
||||
token2text_to_token2image_full_payload,
|
||||
)
|
||||
|
||||
pooling = {"token_ids": [1, 2, 3]}
|
||||
req = SimpleNamespace(output_token_ids=[], additional_information={"speaker": ["alice"]})
|
||||
payload = token2text_to_token2image_full_payload(None, pooling, req)
|
||||
assert payload is not None
|
||||
assert payload["codes"]["audio"] == [1, 2, 3]
|
||||
assert payload["meta"]["finished"].item() is True
|
||||
# additional_information is normalized + carried forward (speaker stays list-wrapped).
|
||||
assert payload.get("speaker") == ["alice"]
|
||||
|
||||
|
||||
def test_qwen2_5_omni_talker2code2wav_token_only_smoke() -> None:
|
||||
"""Smoke: qwen2_5_omni talker→code2wav token_only marker + boundary strip."""
|
||||
from vllm_omni.model_executor.stage_input_processors.qwen2_5_omni import (
|
||||
|
||||
Reference in new issue
Block a user