Merge vLLM-Omni v0.29.0rc1 into edge-infer/omni-0.29.0
The pair for vLLM v0.29.0: rc1's docs pin vllm==0.29.0 and a static scan of rc1's vllm.* imports against the v0.29.0 tree finds nothing missing, while our 0.28-based tree needs seven modules v0.29.0 no longer has (vllm.inputs.preprocess, entrypoints.launcher, openai.cli_args, openai.engine.protocol, serve.utils.server_utils, layers.batch_invariant, models.hunyuan_v1). Ten files conflicted. Upstream's structure is the base everywhere; the fork's features are re-attached to it: - deploy_profile / apply_deploy_profile run before rc1's resolve_omni_config pops deploy_config (async_omni_engine, cli/serve); the deploy-profile selector and the resolve_model_config_path chain it needs stay in entrypoints/utils.py; stage_overrides takes rc1's dict type. - config_factory keeps the lazy diffusion output-type import; the diffusion registry import in rc1's new config/resolver.py is made lazy for the same WP6 reason (TTS path must not load diffusion). - requirements: our core/media split kept; rc1's transformers>=5.13 floor and kernels==0.16.1 applied in core.txt / media.txt. - TTS: rc1's split_granularity and bounded seed plus our output_mode= codec_tokens, _SessionInbox cancel handling and codec DELTA accumulation; our private _conditioning_cache_salt is superseded by rc1's public tts_adapters/base.py::conditioning_cache_salt. - stage_runtime: rc1's single ExitStack G2 path (lock released before READY) replaces our two-path block, with the four worker_phase names the init profiler consumes still emitted; _cpu_placed / host admission kept. Not yet run against vLLM 0.29.0: the tests listed in the W6 record. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
commit
33de5d8629
513 files changed
+35146
-10927
No files matched your search
@@ -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
|
||||
|
||||
"""Generate raw LTX video and audio outputs with the official or Omni runtime."""
|
||||
|
||||
@@ -114,6 +114,29 @@ def _insert_official_paths(official_root: Path) -> None:
|
||||
sys.path.insert(0, path)
|
||||
|
||||
|
||||
def _configure_official_vocoder_determinism() -> None:
|
||||
"""Make the pinned official LTX-2.5 vocoder a stable reference."""
|
||||
from ltx_core.model.audio_vae.vocoder import VocoderWithBWE
|
||||
|
||||
original_forward = VocoderWithBWE.forward
|
||||
if getattr(original_forward, "_vllm_omni_deterministic", False):
|
||||
return
|
||||
|
||||
def deterministic_forward(self: Any, mel_spec: torch.Tensor) -> torch.Tensor:
|
||||
device_type = mel_spec.device.type
|
||||
if device_type != "cuda":
|
||||
return original_forward(self, mel_spec)
|
||||
previous = torch.backends.cudnn.deterministic
|
||||
try:
|
||||
torch.backends.cudnn.deterministic = True
|
||||
return original_forward(self, mel_spec)
|
||||
finally:
|
||||
torch.backends.cudnn.deterministic = previous
|
||||
|
||||
setattr(deterministic_forward, "_vllm_omni_deterministic", True)
|
||||
setattr(VocoderWithBWE, "forward", deterministic_forward)
|
||||
|
||||
|
||||
def _configure_official_sdpa(pipeline: Any) -> None:
|
||||
"""Pin official connector and denoiser attention to cuDNN, with MATH fallback."""
|
||||
from ltx_core.loader.attention_ops import set_attention_module_op
|
||||
@@ -187,6 +210,7 @@ def _run_official(args: argparse.Namespace, request: dict[str, Any]) -> None:
|
||||
if args.official_root is None:
|
||||
raise ValueError("Official backend requires --official-root")
|
||||
_insert_official_paths(args.official_root)
|
||||
_configure_official_vocoder_determinism()
|
||||
# Keep Gemma on the same SDPA path in both subprocesses. DiT attention is
|
||||
# still pinned independently to the explicit cuDNN backend below.
|
||||
torch.backends.cuda.enable_cudnn_sdp(False)
|
||||
|
||||
@@ -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
|
||||
|
||||
"""E2E accuracy guard against a pinned Lightricks LTX pipeline revision.
|
||||
|
||||
@@ -22,11 +22,11 @@ from typing import Literal
|
||||
import numpy as np
|
||||
import pytest
|
||||
import torch
|
||||
from huggingface_hub import hf_hub_download, snapshot_download
|
||||
from torchmetrics.image import PeakSignalNoiseRatio, StructuralSimilarityIndexMeasure
|
||||
|
||||
from tests.e2e.accuracy.helpers import reset_artifact_dir
|
||||
from tests.helpers.mark import hardware_test
|
||||
from vllm_omni.transformers_utils.repo_utils import hf_api
|
||||
|
||||
OFFICIAL_REPOSITORY = "https://github.com/Lightricks/LTX-2.git"
|
||||
OFFICIAL_REVISION = "9377758131b1ffde4b7f766804590a6617bf2ab9"
|
||||
@@ -326,7 +326,7 @@ def _resolve_model(case: LTXAccuracyCase) -> Path:
|
||||
if revision is None and model_id == case.model_id:
|
||||
revision = case.model_revision
|
||||
return Path(
|
||||
snapshot_download(
|
||||
hf_api().snapshot_download(
|
||||
repo_id=model_id,
|
||||
revision=revision,
|
||||
allow_patterns=[
|
||||
@@ -359,7 +359,7 @@ def _resolve_gemma_root(case: LTXAccuracyCase, model: Path) -> Path:
|
||||
if configured_model and Path(configured_model).is_dir():
|
||||
return Path(configured_model)
|
||||
return Path(
|
||||
snapshot_download(
|
||||
hf_api().snapshot_download(
|
||||
repo_id=case.gemma_model_id,
|
||||
revision=case.gemma_model_revision,
|
||||
allow_patterns=[
|
||||
@@ -383,7 +383,7 @@ def _resolve_artifact(artifact: LTXArtifact, model: Path | None = None) -> Path:
|
||||
if model_path.is_file():
|
||||
return model_path
|
||||
return Path(
|
||||
hf_hub_download(
|
||||
hf_api().hf_hub_download(
|
||||
repo_id=artifact.repo_id,
|
||||
repo_type=None if artifact.repo_type == "model" else artifact.repo_type,
|
||||
filename=artifact.filename,
|
||||
|
||||
@@ -164,6 +164,7 @@ def _run_diffusers_wan22_i2v(*, model: str, output_path: Path, conditioning_imag
|
||||
)
|
||||
pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config, flow_shift=FLOW_SHIFT)
|
||||
pipe.to("cuda")
|
||||
_set_matched_attention_backend(pipe)
|
||||
|
||||
_diffusers_dummy_run(pipe)
|
||||
|
||||
|
||||
@@ -34,11 +34,7 @@ TRUE_CFG_SCALE = 4.0
|
||||
SEED = 42
|
||||
SSIM_THRESHOLD = 0.94
|
||||
# With --fa-deterministic, H100 nightlies stably land near SSIM 0.958 / PSNR 27.8
|
||||
# vs Diffusers (see #5734 / #5963), so the primary gates are 0.94 / 27.0.
|
||||
# The SDPA-matched fallback (hub kernel unavailable for the image's torch)
|
||||
# landed at SSIM 0.9687 in build 2954 — keep a slightly tighter SSIM gate for
|
||||
# that path only.
|
||||
SSIM_THRESHOLD_SDPA_FALLBACK = 0.96
|
||||
# vs Diffusers on the FA3 hub path (see #5734 / #5963 / #6971).
|
||||
PSNR_THRESHOLD = 27.0
|
||||
|
||||
MODEL_2512_ID = "Qwen/Qwen-Image-2512"
|
||||
@@ -65,44 +61,6 @@ MEAN_ABS_DIFF_THRESHOLD_2512 = 3e-2
|
||||
P99_ABS_DIFF_THRESHOLD_2512 = 4e-1
|
||||
|
||||
|
||||
_FLASH_ATTN3_HUB_AVAILABLE: bool | None = None
|
||||
|
||||
|
||||
def _flash_attn3_hub_available() -> bool:
|
||||
"""Whether kernels-community/flash-attn3 has a build for this torch/CUDA.
|
||||
|
||||
The hub repo only ships prebuilt variants for specific torch versions;
|
||||
a base-image torch bump can outrun it (build 2952 failed with "Cannot
|
||||
find a build variant for this system"). When it is unavailable, both
|
||||
sides of the comparison fall back to torch SDPA together — the test
|
||||
compares implementations, so the attention math must stay matched.
|
||||
"""
|
||||
global _FLASH_ATTN3_HUB_AVAILABLE
|
||||
if _FLASH_ATTN3_HUB_AVAILABLE is None:
|
||||
try:
|
||||
from kernels import get_kernel
|
||||
|
||||
get_kernel("kernels-community/flash-attn3")
|
||||
_FLASH_ATTN3_HUB_AVAILABLE = True
|
||||
except Exception as exc:
|
||||
print(f"kernels-community/flash-attn3 unavailable ({exc}); using matched torch SDPA on both sides.")
|
||||
_FLASH_ATTN3_HUB_AVAILABLE = False
|
||||
return _FLASH_ATTN3_HUB_AVAILABLE
|
||||
|
||||
|
||||
def _omni_server_env() -> dict[str, str] | None:
|
||||
if _flash_attn3_hub_available():
|
||||
return None
|
||||
return {"DIFFUSION_ATTENTION_BACKEND": "TORCH_SDPA"}
|
||||
|
||||
|
||||
def _set_reference_attention_backend(pipe: DiffusionPipeline) -> None:
|
||||
if _flash_attn3_hub_available():
|
||||
pipe.transformer.set_attention_backend("_flash_3_hub")
|
||||
else:
|
||||
pipe.transformer.set_attention_backend("native")
|
||||
|
||||
|
||||
def _model_name() -> str:
|
||||
return os.environ.get(MODEL_ENV_VAR, MODEL_ID)
|
||||
|
||||
@@ -115,7 +73,22 @@ def _local_files_only(model: str) -> bool:
|
||||
return Path(model).exists()
|
||||
|
||||
|
||||
_OMNI_FA3_HUB_BACKEND = "FLASH_ATTN_3_HUB"
|
||||
_OMNI_FA3_HUB_ENV = {"DIFFUSION_ATTENTION_BACKEND": _OMNI_FA3_HUB_BACKEND}
|
||||
|
||||
|
||||
def _assert_omni_fa3_hub_resolves() -> None:
|
||||
from vllm_omni.diffusion.attention.backends.registry import DiffusionAttentionBackendEnum
|
||||
from vllm_omni.platforms.cuda.platform import CudaOmniPlatform
|
||||
|
||||
path = CudaOmniPlatform.get_diffusion_attn_backend_cls(_OMNI_FA3_HUB_BACKEND, head_size=128)
|
||||
expected = DiffusionAttentionBackendEnum.FLASH_ATTN_3_HUB.get_path()
|
||||
assert path == expected, path
|
||||
print(f"Resolved Omni attention backend: {_OMNI_FA3_HUB_BACKEND} -> {path}")
|
||||
|
||||
|
||||
def _run_vllm_omni_qwen_image(*, model: str, output_path: Path) -> Image.Image:
|
||||
_assert_omni_fa3_hub_resolves()
|
||||
server_args = [
|
||||
"--num-gpus",
|
||||
"1",
|
||||
@@ -124,8 +97,10 @@ def _run_vllm_omni_qwen_image(*, model: str, output_path: Path) -> Image.Image:
|
||||
"--init-timeout",
|
||||
"900",
|
||||
"--fa-deterministic",
|
||||
"--diffusion-attention-backend",
|
||||
_OMNI_FA3_HUB_BACKEND,
|
||||
]
|
||||
with OmniServer(model, server_args, use_omni=True, env_dict=_omni_server_env()) as omni_server:
|
||||
with OmniServer(model, server_args, use_omni=True, env_dict=_OMNI_FA3_HUB_ENV) as omni_server:
|
||||
response = requests.post(
|
||||
f"http://{omni_server.host}:{omni_server.port}/v1/images/generations",
|
||||
json={
|
||||
@@ -161,7 +136,7 @@ def _run_diffusers_qwen_image(*, model: str, output_path: Path) -> Image.Image:
|
||||
trust_remote_code=True,
|
||||
local_files_only=_local_files_only(model),
|
||||
).to("cuda")
|
||||
_set_reference_attention_backend(pipe)
|
||||
pipe.transformer.set_attention_backend("_flash_3_hub")
|
||||
generator = torch.Generator(device="cuda").manual_seed(SEED)
|
||||
result = pipe( # pyright: ignore[reportCallIssue]
|
||||
prompt=PROMPT,
|
||||
@@ -186,8 +161,18 @@ def _run_diffusers_qwen_image(*, model: str, output_path: Path) -> Image.Image:
|
||||
|
||||
|
||||
def _run_vllm_omni_qwen_image_2512(*, model: str, output_path: Path) -> Image.Image:
|
||||
server_args = ["--num-gpus", "1", "--stage-init-timeout", "300", "--init-timeout", "900"]
|
||||
with OmniServer(model, server_args, use_omni=True, env_dict=_omni_server_env()) as omni_server:
|
||||
_assert_omni_fa3_hub_resolves()
|
||||
server_args = [
|
||||
"--num-gpus",
|
||||
"1",
|
||||
"--stage-init-timeout",
|
||||
"300",
|
||||
"--init-timeout",
|
||||
"900",
|
||||
"--diffusion-attention-backend",
|
||||
_OMNI_FA3_HUB_BACKEND,
|
||||
]
|
||||
with OmniServer(model, server_args, use_omni=True, env_dict=_OMNI_FA3_HUB_ENV) as omni_server:
|
||||
response = requests.post(
|
||||
f"http://{omni_server.host}:{omni_server.port}/v1/images/generations",
|
||||
json={
|
||||
@@ -223,7 +208,7 @@ def _run_diffusers_qwen_image_2512(*, model: str, output_path: Path) -> Image.Im
|
||||
trust_remote_code=True,
|
||||
local_files_only=_local_files_only(model),
|
||||
).to("cuda")
|
||||
_set_reference_attention_backend(pipe)
|
||||
pipe.transformer.set_attention_backend("_flash_3_hub")
|
||||
generator = torch.Generator(device="cuda").manual_seed(SEED_2512)
|
||||
result = pipe( # pyright: ignore[reportCallIssue]
|
||||
prompt=PROMPT_2512,
|
||||
@@ -262,7 +247,7 @@ def test_qwen_image_matches_diffusers(accuracy_artifact_root: Path) -> None:
|
||||
diffusers_image=diffusers_output,
|
||||
width=WIDTH,
|
||||
height=HEIGHT,
|
||||
ssim_threshold=SSIM_THRESHOLD if _flash_attn3_hub_available() else SSIM_THRESHOLD_SDPA_FALLBACK,
|
||||
ssim_threshold=SSIM_THRESHOLD,
|
||||
psnr_threshold=PSNR_THRESHOLD,
|
||||
)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
"""E2E test that follows the EXACT same flow as
|
||||
``verl-omni/tests/workers/rollout/rollout_vllm/test_vllm_omni_generate.py``
|
||||
@@ -35,7 +35,6 @@ from uuid import uuid4
|
||||
import pytest
|
||||
import ray
|
||||
import torch
|
||||
from huggingface_hub import snapshot_download
|
||||
from omegaconf import OmegaConf
|
||||
from transformers import AutoTokenizer
|
||||
|
||||
@@ -46,6 +45,7 @@ from tests.e2e.features.helpers.verl_omni_server import (
|
||||
vLLMOmniHttpServerLocal,
|
||||
)
|
||||
from tests.helpers.mark import hardware_test
|
||||
from vllm_omni.transformers_utils.repo_utils import hf_api
|
||||
|
||||
MODEL = "tiny-random/Qwen-Image"
|
||||
TOKENIZER_MODEL = "Qwen/Qwen2-1.5B-Instruct"
|
||||
@@ -55,7 +55,7 @@ _MIN_PROMPT_TOKENS = 35
|
||||
def _resolve_model_path(repo_id: str) -> str:
|
||||
if os.path.isdir(repo_id):
|
||||
return repo_id
|
||||
return snapshot_download(repo_id=repo_id)
|
||||
return hf_api().snapshot_download(repo_id=repo_id)
|
||||
|
||||
|
||||
@lru_cache(maxsize=1)
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
|
||||
"""E2E offline tests for Audio8 TTS Preview (DualAR, 44.1 kHz codec).
|
||||
|
||||
The prompt is pre-tokenized here (not built from ``mm_processor_kwargs``)
|
||||
because Audio8 TTS shares Fish Speech's protocol: text-only prompts are plain
|
||||
token ids, and voice-clone prompts are a placeholder of the exact final length
|
||||
whose real embeddings are built model-side from the encoded reference audio.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
os.environ["VLLM_WORKER_MULTIPROC_METHOD"] = "spawn"
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.helpers.mark import hardware_test
|
||||
from tests.helpers.runtime import OmniRunner, OmniRunnerHandler
|
||||
from tests.helpers.stage_config import get_deploy_config_path
|
||||
|
||||
MODEL = os.environ.get("AUDIO8_TTS_MODEL_PATH", "Audio8/Audio8-TTS-Preview-0.6b")
|
||||
DEPLOY_CONFIG = get_deploy_config_path("audio8_tts.yaml")
|
||||
SAMPLE_RATE = 44100
|
||||
TEXT = "The weather is nice today, perfect for a walk in the park."
|
||||
|
||||
# Four distinct inputs for the concurrency test: distinct text is required so a
|
||||
# leaked per-request codec buffer (which would make two requests decode to the
|
||||
# same audio) actually fails the pairwise-difference assertion.
|
||||
CONCURRENT_TEXTS = [
|
||||
"The weather is nice today, perfect for a walk in the park.",
|
||||
"She sold seashells by the seashore all through the summer.",
|
||||
"Our train departs at a quarter past nine tomorrow morning.",
|
||||
"He planted rows of tomatoes and basil behind the old house.",
|
||||
]
|
||||
|
||||
# The checkpoint registers its own `arktts` config in vllm-omni, so remote code
|
||||
# must stay disabled (transformers would otherwise prefer the checkpoint's
|
||||
# auto_map and bypass the Qwen2-shaped view Qwen2Model needs).
|
||||
_OMNI_RUNNER_PARAM = (MODEL, DEPLOY_CONFIG, {"trust_remote_code": False})
|
||||
|
||||
pytestmark = pytest.mark.parametrize("omni_runner", [_OMNI_RUNNER_PARAM], indirect=True)
|
||||
|
||||
|
||||
def _text_only_prompt(text: str = TEXT) -> dict:
|
||||
from transformers import AutoTokenizer
|
||||
|
||||
from vllm_omni.model_executor.models.audio8_tts.prompt_utils import build_text_only_prompt_ids
|
||||
|
||||
tokenizer = AutoTokenizer.from_pretrained(MODEL)
|
||||
prompt_ids, normalized_text = build_text_only_prompt_ids(tokenizer, text)
|
||||
return {"prompt_token_ids": prompt_ids, "additional_information": {"text": [normalized_text]}}
|
||||
|
||||
|
||||
# At ``core_model`` (L1/L2) the harness patches every stage to
|
||||
# ``load_format: dummy``, so the AR runs on random weights: it never emits EOS
|
||||
# and always generates to ``max_tokens`` (1024 frames ~= 47.5 s). Duration
|
||||
# bounds are therefore only meaningful once real weights load, at
|
||||
# ``advanced_model`` / ``full_model``.
|
||||
_REAL_WEIGHT_RUN_LEVELS = frozenset({"advanced_model", "full_model"})
|
||||
|
||||
|
||||
def _duration_bounds(run_level: str) -> dict[str, float]:
|
||||
if run_level not in _REAL_WEIGHT_RUN_LEVELS:
|
||||
return {}
|
||||
return {"min_duration_s": 0.5, "max_duration_s": 30.0}
|
||||
|
||||
|
||||
@pytest.mark.core_model
|
||||
@pytest.mark.advanced_model
|
||||
@pytest.mark.tts
|
||||
@hardware_test(res={"cuda": "L4"}, num_cards=1)
|
||||
def test_text_to_audio_001(omni_runner: OmniRunner, run_level: str) -> None:
|
||||
"""Default deploy, single request, text-only synthesis.
|
||||
|
||||
Deploy Setting: audio8_tts.yaml
|
||||
Input Modal: text
|
||||
Output Modal: audio
|
||||
"""
|
||||
prompt = _text_only_prompt()
|
||||
request_config = {
|
||||
"input": TEXT,
|
||||
"prompt_token_ids": prompt["prompt_token_ids"],
|
||||
"additional_information": prompt["additional_information"],
|
||||
"response_format": "wav",
|
||||
"expected_sample_rate": SAMPLE_RATE,
|
||||
**_duration_bounds(run_level),
|
||||
}
|
||||
OmniRunnerHandler(omni_runner).send_tokenized_tts_request(request_config)
|
||||
|
||||
|
||||
@pytest.mark.advanced_model
|
||||
@pytest.mark.tts
|
||||
@hardware_test(res={"cuda": "L4"}, num_cards=1)
|
||||
def test_text_to_audio_concurrent_002(omni_runner: OmniRunner, run_level: str) -> None:
|
||||
"""Four concurrent requests with distinct text: stage 0 runs ``max_num_seqs: 4``.
|
||||
|
||||
Per-request codec state is keyed by request id. The four inputs are
|
||||
deliberately distinct and the decoded outputs are asserted pairwise
|
||||
different, so leaked codec state (which would make two requests decode to
|
||||
identical audio) fails here, and only here.
|
||||
"""
|
||||
prompts = [_text_only_prompt(text) for text in CONCURRENT_TEXTS]
|
||||
request_config = {
|
||||
"input": CONCURRENT_TEXTS[0],
|
||||
"prompt_token_ids": [p["prompt_token_ids"] for p in prompts],
|
||||
"additional_information": [p["additional_information"] for p in prompts],
|
||||
"response_format": "wav",
|
||||
"expected_sample_rate": SAMPLE_RATE,
|
||||
"assert_distinct_outputs": True,
|
||||
**_duration_bounds(run_level),
|
||||
}
|
||||
OmniRunnerHandler(omni_runner).send_tokenized_tts_request(request_config)
|
||||
@@ -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
|
||||
"""
|
||||
Offline E2E smoke test for CosyVoice3 zero-shot reference inference.
|
||||
|
||||
@@ -20,7 +20,6 @@ from pathlib import Path
|
||||
import numpy as np
|
||||
import pytest
|
||||
import soundfile as sf
|
||||
from huggingface_hub import snapshot_download
|
||||
from vllm.sampling_params import SamplingParams
|
||||
|
||||
from tests.helpers.mark import hardware_test
|
||||
@@ -29,6 +28,7 @@ from tests.helpers.runtime import OmniRunner
|
||||
from tests.helpers.stage_config import get_deploy_config_path
|
||||
from vllm_omni.model_executor.models.cosyvoice3.tokenizer import get_qwen_tokenizer
|
||||
from vllm_omni.transformers_utils.configs.cosyvoice3 import CosyVoice3Config
|
||||
from vllm_omni.transformers_utils.repo_utils import hf_api
|
||||
|
||||
MODEL = "FunAudioLLM/Fun-CosyVoice3-0.5B-2512"
|
||||
MODEL_DIR_ENV = "VLLM_OMNI_COSYVOICE3_MODEL_DIR"
|
||||
@@ -58,7 +58,7 @@ def _resolve_model_dir() -> Path:
|
||||
override = os.environ.get(MODEL_DIR_ENV)
|
||||
if override:
|
||||
return Path(override).expanduser().resolve()
|
||||
return Path(snapshot_download(MODEL, allow_patterns=["*"]))
|
||||
return Path(hf_api().snapshot_download(MODEL, allow_patterns=["*"]))
|
||||
|
||||
|
||||
def _reference_zero_shot_stage0_sampling(*, text: str) -> SamplingParams:
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
|
||||
|
||||
"""
|
||||
End-to-end test for MammothModa2 text-to-image generation.
|
||||
|
||||
@@ -19,12 +22,12 @@ from pathlib import Path
|
||||
|
||||
import pytest
|
||||
import torch
|
||||
from huggingface_hub import snapshot_download
|
||||
from vllm.sampling_params import SamplingParams
|
||||
|
||||
from tests.helpers.mark import hardware_test
|
||||
from tests.helpers.runtime import OmniRunner
|
||||
from tests.helpers.stage_config import get_deploy_config_path
|
||||
from vllm_omni.transformers_utils.repo_utils import hf_api
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Constants
|
||||
@@ -64,7 +67,7 @@ _PIXEL_SAMPLE_COORDS = [
|
||||
# Helpers
|
||||
# ---------------------------------------------------------------------------
|
||||
def _load_t2i_gen_config(repo_id: str) -> dict:
|
||||
weights_dir = Path(snapshot_download(repo_id))
|
||||
weights_dir = Path(hf_api().snapshot_download(repo_id))
|
||||
cfg_path = weights_dir / "t2i_generation_config.json"
|
||||
if not cfg_path.exists():
|
||||
pytest.skip(f"t2i_generation_config.json not found at {cfg_path}")
|
||||
|
||||
@@ -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
|
||||
"""E2E offline inference tests for MOSS-TTS-Realtime (MossTTSRealtime, 1.7B).
|
||||
|
||||
Uses the standard omni_runner + pytestmark pattern (one module-scoped engine
|
||||
@@ -160,12 +160,13 @@ def _build_request(ref_audio_path: str, text: str) -> dict:
|
||||
Frees the codec model before returning to avoid competing with the
|
||||
running vllm engine for GPU/CPU memory.
|
||||
"""
|
||||
from huggingface_hub import snapshot_download
|
||||
from transformers import AutoModel, AutoTokenizer
|
||||
|
||||
from vllm_omni.transformers_utils.repo_utils import hf_api
|
||||
|
||||
# Step 1: locate the realtime processor module in the snapshot.
|
||||
try:
|
||||
snap_dir = Path(snapshot_download(repo_id=MODEL))
|
||||
snap_dir = Path(hf_api().snapshot_download(repo_id=MODEL))
|
||||
except Exception as exc:
|
||||
msg = f"Cannot locate snapshot for {MODEL}: {exc}"
|
||||
if os.environ.get("MOSS_TTS_SKIP_ON_NET_FAIL"):
|
||||
|
||||
@@ -65,7 +65,12 @@ def _stage_config():
|
||||
# gains enough VRAM headroom for a no-eager run, add a companion test.
|
||||
return modify_stage_config(
|
||||
_CI_DEPLOY,
|
||||
updates={"stages": {0: {"enforce_eager": True}, 1: {"enforce_eager": True}}},
|
||||
updates={
|
||||
"stages": {
|
||||
0: {"enforce_eager": True, "moe_backend": "auto"},
|
||||
1: {"enforce_eager": True},
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ from pathlib import Path
|
||||
from types import SimpleNamespace
|
||||
|
||||
import pytest
|
||||
from huggingface_hub import snapshot_download
|
||||
|
||||
from tests.helpers.runtime import OmniServerParams, get_model_prefix
|
||||
from tests.helpers.stage_config import (
|
||||
@@ -20,6 +19,7 @@ from tests.helpers.stage_config import (
|
||||
get_deploy_duplex_max_sessions,
|
||||
modify_stage_config,
|
||||
)
|
||||
from vllm_omni.transformers_utils.repo_utils import hf_api
|
||||
|
||||
MODEL = "openbmb/MiniCPM-o-4_5"
|
||||
DEPLOY_CONFIG_REL = "minicpmo_4_5.yaml"
|
||||
@@ -111,7 +111,7 @@ def resolve_ref_audio() -> Path:
|
||||
model_prefix = get_model_prefix()
|
||||
model_root = Path(model_prefix) / MODEL if model_prefix else Path(MODEL)
|
||||
if not model_root.is_dir():
|
||||
model_root = Path(snapshot_download(MODEL, local_files_only=True))
|
||||
model_root = Path(hf_api().snapshot_download(MODEL, local_files_only=True))
|
||||
ref_audio = model_root / REF_AUDIO_RELATIVE_PATH
|
||||
if not ref_audio.is_file():
|
||||
raise FileNotFoundError(f"MiniCPM-o checkpoint ref audio is missing: {ref_audio}")
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
|
||||
"""E2E online tests for Audio8 TTS Preview via /v1/audio/speech.
|
||||
|
||||
Real model inference (no mocks): text-only synthesis, streaming, and zero-shot
|
||||
voice cloning. The reference audio is inlined as a base64 data URL because CI
|
||||
hosts cannot fetch external URLs.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
os.environ["VLLM_WORKER_MULTIPROC_METHOD"] = "spawn"
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.helpers.mark import hardware_test
|
||||
from tests.helpers.media import get_asset_path
|
||||
from tests.helpers.runtime import OmniServerParams
|
||||
from tests.helpers.stage_config import get_deploy_config_path
|
||||
|
||||
MODEL = os.environ.get("AUDIO8_TTS_MODEL_PATH", "Audio8/Audio8-TTS-Preview-0.6b")
|
||||
DEFAULT_AUDIO_SPEECH_TIMEOUT_S = 300.0
|
||||
# The codec decodes at 44.1 kHz; raw PCM carries no header, so assertions that
|
||||
# depend on the rate (HNR pitch search) have to be told explicitly.
|
||||
SAMPLE_RATE = 44100
|
||||
MAX_CONCURRENT = 4
|
||||
|
||||
# ~0.5 s of 44.1 kHz mono PCM_16 WAV.
|
||||
_MIN_AUDIO_BYTES = 40_000
|
||||
|
||||
# Reused vendored asset (3.5 s, Chinese) plus its exact transcript: Audio8 TTS
|
||||
# requires the reference transcript to match the recording.
|
||||
REF_AUDIO_URL = get_asset_path("cosyvoice3/zero_shot_prompt.wav", as_data_url=True)
|
||||
REF_TEXT = "希望你以后能够做的比我还好呦。"
|
||||
|
||||
|
||||
def get_prompt(prompt_type: str = "en") -> str:
|
||||
prompts = {
|
||||
"en": "The weather is nice today, perfect for a walk in the park.",
|
||||
"zh": "今天天气很好,非常适合去公园散步。",
|
||||
}
|
||||
return prompts.get(prompt_type, prompts["en"])
|
||||
|
||||
|
||||
tts_server_params = [
|
||||
pytest.param(
|
||||
OmniServerParams(
|
||||
model=MODEL,
|
||||
stage_config_path=get_deploy_config_path("audio8_tts.yaml"),
|
||||
# No --trust-remote-code: vllm-omni owns the `arktts` config.
|
||||
server_args=["--disable-log-stats"],
|
||||
),
|
||||
id="audio8_tts",
|
||||
)
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.core_model
|
||||
@pytest.mark.advanced_model
|
||||
@pytest.mark.tts
|
||||
@hardware_test(res={"cuda": "L4"}, num_cards=1)
|
||||
@pytest.mark.parametrize("omni_server", tts_server_params, indirect=True)
|
||||
def test_text_to_audio_001(omni_server, openai_client) -> None:
|
||||
"""Baseline smoke: default deploy, non-streaming WAV.
|
||||
|
||||
Deploy Setting: audio8_tts.yaml
|
||||
Input Modal: text
|
||||
Output Modal: audio
|
||||
Input Setting: stream=False
|
||||
Datasets: few requests (max_num_seqs=4)
|
||||
"""
|
||||
request_config = {
|
||||
"model": omni_server.model,
|
||||
"input": get_prompt(),
|
||||
"stream": False,
|
||||
"timeout": DEFAULT_AUDIO_SPEECH_TIMEOUT_S,
|
||||
"response_format": "wav",
|
||||
"min_audio_bytes": _MIN_AUDIO_BYTES,
|
||||
}
|
||||
openai_client.send_audio_speech_request(request_config, request_num=MAX_CONCURRENT)
|
||||
|
||||
|
||||
@pytest.mark.advanced_model
|
||||
@pytest.mark.tts
|
||||
@hardware_test(res={"cuda": "L4"}, num_cards=1)
|
||||
@pytest.mark.parametrize("omni_server", tts_server_params, indirect=True)
|
||||
def test_text_to_audio_streaming_002(omni_server, openai_client) -> None:
|
||||
"""Streaming PCM: exercises the async_chunk path end to end.
|
||||
|
||||
Deploy Setting: audio8_tts.yaml (async_chunk: true)
|
||||
Input Setting: stream=True, response_format=pcm
|
||||
"""
|
||||
request_config = {
|
||||
"model": omni_server.model,
|
||||
"input": get_prompt(),
|
||||
"stream": True,
|
||||
"stream_format": "audio",
|
||||
"timeout": DEFAULT_AUDIO_SPEECH_TIMEOUT_S,
|
||||
"response_format": "pcm",
|
||||
"min_audio_bytes": _MIN_AUDIO_BYTES,
|
||||
# Raw PCM has no header: without this the harness assumes 24 kHz and the
|
||||
# HNR pitch search lands on 147-735 Hz instead of 80-400 Hz, scoring
|
||||
# clean 44.1 kHz speech ~1.9 dB too low.
|
||||
"expected_sample_rate": SAMPLE_RATE,
|
||||
}
|
||||
openai_client.send_audio_speech_request(request_config)
|
||||
|
||||
|
||||
@pytest.mark.advanced_model
|
||||
@pytest.mark.tts
|
||||
@hardware_test(res={"cuda": "L4"}, num_cards=1)
|
||||
@pytest.mark.parametrize("omni_server", tts_server_params, indirect=True)
|
||||
def test_voice_clone_003(omni_server, openai_client) -> None:
|
||||
"""Zero-shot voice cloning: the reference audio is encoded model-side and
|
||||
its codec codes are spliced into the prompt.
|
||||
|
||||
Input Modal: text + ref_audio + ref_text
|
||||
"""
|
||||
request_config = {
|
||||
"model": omni_server.model,
|
||||
"input": get_prompt("zh"),
|
||||
"ref_audio": REF_AUDIO_URL,
|
||||
"ref_text": REF_TEXT,
|
||||
"stream": False,
|
||||
"timeout": DEFAULT_AUDIO_SPEECH_TIMEOUT_S,
|
||||
"response_format": "wav",
|
||||
"min_audio_bytes": _MIN_AUDIO_BYTES,
|
||||
}
|
||||
openai_client.send_audio_speech_request(request_config)
|
||||
|
||||
|
||||
@pytest.mark.advanced_model
|
||||
@pytest.mark.tts
|
||||
@hardware_test(res={"cuda": "L4"}, num_cards=1)
|
||||
@pytest.mark.parametrize("omni_server", tts_server_params, indirect=True)
|
||||
def test_voice_clone_requires_ref_text_004(omni_server, openai_client) -> None:
|
||||
"""``ref_audio`` without ``ref_text`` must be rejected, not silently
|
||||
synthesized with an untethered voice."""
|
||||
request_config = {
|
||||
"model": omni_server.model,
|
||||
"input": get_prompt(),
|
||||
"ref_audio": REF_AUDIO_URL,
|
||||
"stream": False,
|
||||
"timeout": DEFAULT_AUDIO_SPEECH_TIMEOUT_S,
|
||||
"response_format": "wav",
|
||||
"status_code": (400, 422),
|
||||
"err_message": "ref_text",
|
||||
}
|
||||
openai_client.send_audio_speech_request(request_config)
|
||||
|
||||
|
||||
@pytest.mark.advanced_model
|
||||
@pytest.mark.tts
|
||||
@hardware_test(res={"cuda": "L4"}, num_cards=1)
|
||||
@pytest.mark.parametrize("omni_server", tts_server_params, indirect=True)
|
||||
def test_empty_input_is_rejected_005(omni_server, openai_client) -> None:
|
||||
request_config = {
|
||||
"model": omni_server.model,
|
||||
"input": " ",
|
||||
"stream": False,
|
||||
"timeout": DEFAULT_AUDIO_SPEECH_TIMEOUT_S,
|
||||
"response_format": "wav",
|
||||
"status_code": (400, 422),
|
||||
"err_message": "Input text cannot be empty",
|
||||
}
|
||||
openai_client.send_audio_speech_request(request_config)
|
||||
@@ -85,5 +85,7 @@ def test_text_only_nonstreaming_pcm_001(omni_server, openai_client) -> None:
|
||||
"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,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
|
||||
"""End-to-end online serving test for GR00T N1.7 through the OpenPI robot endpoint."""
|
||||
|
||||
import os
|
||||
@@ -29,8 +29,7 @@ test_params = [
|
||||
OmniServerParams(
|
||||
model=MODEL,
|
||||
stage_config_path=get_deploy_config_path("Gr00tN1d7.yaml"),
|
||||
server_args=["--disable-log-stats"],
|
||||
env_dict={"VLLM_DISABLE_COMPILE_CACHE": "1", "GR00T_NOISE_SEED": "42"},
|
||||
env_dict={"VLLM_DISABLE_COMPILE_CACHE": "1"},
|
||||
init_timeout=1200,
|
||||
stage_init_timeout=900,
|
||||
),
|
||||
@@ -162,14 +161,14 @@ def test_gr00t_n1d7_openpi_online(omni_server, openai_client) -> None:
|
||||
@hardware_test(res={"cuda": "L4"}, num_cards=1)
|
||||
@pytest.mark.parametrize("omni_server", test_params, indirect=True)
|
||||
def test_gr00t_n1d7_openpi_precision(omni_server, openai_client) -> None:
|
||||
"""Assert actions match Isaac-GR00T reference (GR00T_NOISE_SEED=42, zero inputs)."""
|
||||
"""Assert actions match Isaac-GR00T reference (request seed=42, zero inputs)."""
|
||||
response = openai_client.send_robot_openpi_ws_request(
|
||||
{
|
||||
"operations": [
|
||||
{"endpoint": "reset", "payload": {}},
|
||||
{
|
||||
"endpoint": "infer",
|
||||
"payload": build_openpi_droid_observation(session_id="gr00t-precision-e2e"),
|
||||
"payload": build_openpi_droid_observation(session_id="gr00t-precision-e2e", seed=42),
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
@@ -24,6 +24,9 @@ from tests.helpers.stage_config import get_deploy_config_path, modify_stage_conf
|
||||
os.environ["VLLM_WORKER_MULTIPROC_METHOD"] = "spawn"
|
||||
|
||||
_MODEL = "openbmb/MiniCPM-o-4_5"
|
||||
_NATIVE_CHAT_TEMPLATE = (
|
||||
Path(__file__).resolve().parents[3] / "vllm_omni/transformers_utils/chat_templates/minicpmo45_native.jinja"
|
||||
)
|
||||
_CI_DEPLOY = modify_stage_config(
|
||||
get_deploy_config_path("minicpmo_4_5.yaml"),
|
||||
updates={
|
||||
@@ -63,7 +66,14 @@ test_params = [
|
||||
model=_MODEL,
|
||||
stage_config_path=_CI_DEPLOY,
|
||||
use_stage_cli=False,
|
||||
server_args=["--trust-remote-code", "--async-chunk"],
|
||||
server_args=[
|
||||
"--trust-remote-code",
|
||||
"--async-chunk",
|
||||
"--chat-template",
|
||||
str(_NATIVE_CHAT_TEMPLATE),
|
||||
"--chat-template-content-format",
|
||||
"openai",
|
||||
],
|
||||
env_dict={
|
||||
"VLLM_CONFIGURE_LOGGING": "1",
|
||||
"VLLM_LOGGING_CONFIG_PATH": str(_PROMPT_LOGGING_CONFIG_PATH),
|
||||
@@ -265,11 +275,18 @@ def test_image_to_text_audio_001(omni_server, openai_client) -> None:
|
||||
Input Setting: stream=True
|
||||
"""
|
||||
image_data_url = f"data:image/jpeg;base64,{generate_synthetic_image(24, 24)['base64']}"
|
||||
messages = dummy_messages_from_mix_data(
|
||||
system_prompt=get_system_prompt(),
|
||||
image_data_url=image_data_url,
|
||||
content_text=get_prompt("text_image"),
|
||||
)
|
||||
# Match the native image-chat layout explicitly; do not rely on the
|
||||
# renderer moving media placeholders ahead of text.
|
||||
messages = [
|
||||
get_system_prompt(),
|
||||
{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{"type": "image_url", "image_url": {"url": image_data_url}},
|
||||
{"type": "text", "text": get_prompt("text_image")},
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
request_config = {
|
||||
"model": omni_server.model,
|
||||
|
||||
@@ -30,10 +30,27 @@ from tests.e2e.online_serving.run_minicpmo_realtime_duplex_soft_interrupt import
|
||||
run_soft_interrupt,
|
||||
)
|
||||
from tests.helpers.mark import hardware_test
|
||||
from vllm_omni.entrypoints.duplex.server_vad import (
|
||||
SILERO_VAD_FILENAME,
|
||||
SILERO_VAD_REPO_ID,
|
||||
SILERO_VAD_REVISION,
|
||||
)
|
||||
|
||||
pytestmark = [pytest.mark.full_model, pytest.mark.omni]
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def _cached_server_vad_artifact() -> None:
|
||||
"""Cache the pinned ONNX artifact before the Realtime server starts."""
|
||||
from huggingface_hub import hf_hub_download
|
||||
|
||||
hf_hub_download(
|
||||
repo_id=SILERO_VAD_REPO_ID,
|
||||
filename=SILERO_VAD_FILENAME,
|
||||
revision=SILERO_VAD_REVISION,
|
||||
)
|
||||
|
||||
|
||||
@hardware_test(res={"cuda": "H100", "npu": "A3"}, num_cards=1)
|
||||
@pytest.mark.parametrize("omni_server", SERVER_PARAMS, indirect=True)
|
||||
def test_duplex_admission_and_expiry_reaper(omni_server, tmp_path: Path) -> None:
|
||||
@@ -97,7 +114,7 @@ def test_duplex_soft_interrupt(omni_server, tmp_path: Path) -> None:
|
||||
|
||||
@hardware_test(res={"cuda": "H100"}, num_cards=1)
|
||||
@pytest.mark.parametrize("omni_server", SERVER_PARAMS, indirect=True)
|
||||
def test_duplex_server_vad_hard_interrupt(omni_server) -> None:
|
||||
def test_duplex_server_vad_hard_interrupt(_cached_server_vad_artifact, omni_server) -> None:
|
||||
result = asyncio.run(
|
||||
run_server_vad_interrupt(
|
||||
SimpleNamespace(
|
||||
|
||||
@@ -7,7 +7,10 @@ Tests verify that the OmniVoice model generates valid audio when
|
||||
accessed through the standard OpenAI-compatible speech API.
|
||||
"""
|
||||
|
||||
import io
|
||||
import os
|
||||
import wave
|
||||
from collections.abc import Sequence
|
||||
|
||||
os.environ["VLLM_WORKER_MULTIPROC_METHOD"] = "spawn"
|
||||
|
||||
@@ -15,7 +18,7 @@ import pytest
|
||||
|
||||
from tests.helpers.mark import hardware_test
|
||||
from tests.helpers.media import get_asset_path
|
||||
from tests.helpers.runtime import OmniServerParams
|
||||
from tests.helpers.runtime import OmniResponse, OmniServerParams
|
||||
from tests.helpers.stage_config import get_deploy_config_path
|
||||
from vllm_omni.entrypoints.openai.serving_speech import _DEFAULT_VOICE_NAME
|
||||
|
||||
@@ -34,6 +37,10 @@ STAGE_CONFIG = get_deploy_config_path("omnivoice.yaml")
|
||||
EXTRA_ARGS = [
|
||||
"--trust-remote-code",
|
||||
"--disable-log-stats",
|
||||
"--max-num-seqs",
|
||||
"8",
|
||||
"--request-batch-max-wait-ms",
|
||||
"50",
|
||||
]
|
||||
TEST_PARAMS = [
|
||||
OmniServerParams(
|
||||
@@ -42,7 +49,14 @@ TEST_PARAMS = [
|
||||
server_args=EXTRA_ARGS,
|
||||
)
|
||||
]
|
||||
|
||||
STEP_EXECUTION_ARGS = EXTRA_ARGS + ["--step-execution"]
|
||||
STEP_EXECUTION_PARAMS = [
|
||||
OmniServerParams(
|
||||
model=MODEL,
|
||||
stage_config_path=STAGE_CONFIG,
|
||||
server_args=STEP_EXECUTION_ARGS,
|
||||
)
|
||||
]
|
||||
# Lower this in ``request_config`` via ``min_audio_bytes`` if a run produces legitimately short WAVs.
|
||||
_DEFAULT_MIN_AUDIO_BYTES = 5000
|
||||
|
||||
@@ -58,6 +72,33 @@ def get_prompt(prompt_type="text"):
|
||||
return prompts.get(prompt_type, prompts["text"])
|
||||
|
||||
|
||||
def _assert_valid_omnivoice_wav_responses(responses: Sequence[OmniResponse]) -> None:
|
||||
"""Validate that every concurrent response contains plausible OmniVoice audio."""
|
||||
audio_shapes: list[tuple[int, int, int, int]] = []
|
||||
for response in responses:
|
||||
audio_bytes = response.audio_bytes
|
||||
assert audio_bytes is not None
|
||||
assert audio_bytes.startswith(b"RIFF")
|
||||
with wave.open(io.BytesIO(audio_bytes), "rb") as wav_file:
|
||||
num_channels = wav_file.getnchannels()
|
||||
sample_width = wav_file.getsampwidth()
|
||||
sample_rate = wav_file.getframerate()
|
||||
num_frames = wav_file.getnframes()
|
||||
assert num_channels == 1
|
||||
assert sample_width == 2
|
||||
assert sample_rate == 24000
|
||||
assert num_frames > 0
|
||||
audio_shapes.append((num_channels, sample_width, sample_rate, num_frames))
|
||||
|
||||
duration_s = num_frames / sample_rate
|
||||
assert 0.1 <= duration_s <= 30.0
|
||||
|
||||
# Identical prompts use the same estimated target length. Their samples may
|
||||
# differ numerically across batch layouts, but the decoded audio shape must
|
||||
# remain consistent across concurrent requests.
|
||||
assert len(set(audio_shapes)) == 1
|
||||
|
||||
|
||||
@pytest.mark.parametrize("omni_server", TEST_PARAMS, indirect=True)
|
||||
class TestOmniVoiceTTS:
|
||||
"""E2E tests for OmniVoice TTS model."""
|
||||
@@ -74,6 +115,57 @@ class TestOmniVoiceTTS:
|
||||
}
|
||||
online_client.send_audio_speech_request(request_config)
|
||||
|
||||
@hardware_test(res={"cuda": "L4"}, num_cards=1)
|
||||
def test_speech_auto_voice_batch(self, omni_server, openai_client) -> None:
|
||||
"""Test concurrent request-batch TTS generation."""
|
||||
batch_request_config = {
|
||||
"model": omni_server.model,
|
||||
"input": get_prompt("text"),
|
||||
"response_format": "wav",
|
||||
"seed": 42,
|
||||
"min_audio_bytes": _DEFAULT_MIN_AUDIO_BYTES,
|
||||
}
|
||||
batch_r = openai_client.send_audio_speech_request(batch_request_config, request_num=2)
|
||||
assert len(batch_r) == 2
|
||||
_assert_valid_omnivoice_wav_responses(batch_r)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("omni_server", STEP_EXECUTION_PARAMS, indirect=True)
|
||||
class TestOmniVoiceStepExecution:
|
||||
"""E2E tests for OmniVoice TTS model."""
|
||||
|
||||
@hardware_test(res={"cuda": "L4"}, num_cards=1)
|
||||
def test_speech_auto_voice_step_execution(self, omni_server, openai_client) -> None:
|
||||
"""Test auto voice TTS generation (text only, no reference audio)."""
|
||||
request_config = {
|
||||
"model": omni_server.model,
|
||||
"input": get_prompt("text"),
|
||||
"response_format": "wav",
|
||||
"timeout": 180.0,
|
||||
"min_audio_bytes": _DEFAULT_MIN_AUDIO_BYTES,
|
||||
"extra_params": {
|
||||
"num_inference_steps": 32,
|
||||
},
|
||||
}
|
||||
openai_client.send_audio_speech_request(request_config)
|
||||
|
||||
@hardware_test(res={"cuda": "L4"}, num_cards=1)
|
||||
def test_speech_auto_voice_batch_step_execution(self, omni_server, openai_client) -> None:
|
||||
"""Test concurrent step-execution TTS generation."""
|
||||
batch_request_config = {
|
||||
"model": omni_server.model,
|
||||
"input": get_prompt("text"),
|
||||
"response_format": "wav",
|
||||
"seed": 42,
|
||||
"min_audio_bytes": _DEFAULT_MIN_AUDIO_BYTES,
|
||||
"extra_params": {
|
||||
"num_inference_steps": 32,
|
||||
},
|
||||
}
|
||||
batch_r = openai_client.send_audio_speech_request(batch_request_config, request_num=2)
|
||||
assert len(batch_r) == 2
|
||||
_assert_valid_omnivoice_wav_responses(batch_r)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("omni_server", TEST_PARAMS, indirect=True)
|
||||
class TestOmniVoiceSeed:
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
"""Cross-mode full-model parity tests for OmniVoice."""
|
||||
|
||||
import os
|
||||
|
||||
os.environ["VLLM_WORKER_MULTIPROC_METHOD"] = "spawn"
|
||||
|
||||
import pytest
|
||||
import requests
|
||||
|
||||
from tests.helpers.mark import hardware_test
|
||||
from tests.helpers.runtime import OmniServer
|
||||
from tests.helpers.stage_config import get_deploy_config_path
|
||||
|
||||
pytestmark = [pytest.mark.slow, pytest.mark.tts]
|
||||
|
||||
MODEL = "k2-fsa/OmniVoice"
|
||||
STAGE_CONFIG = get_deploy_config_path("omnivoice.yaml")
|
||||
PROMPT = "The weather is nice today, perfect for a walk in the park."
|
||||
|
||||
payload = {
|
||||
"model": MODEL,
|
||||
"input": PROMPT,
|
||||
"language": "English",
|
||||
"seed": 42,
|
||||
"response_format": "wav",
|
||||
"extra_params": {"num_inference_steps": 32},
|
||||
}
|
||||
|
||||
|
||||
def _generate_without_graph(server_args: list[str]) -> bytes:
|
||||
with OmniServer(
|
||||
MODEL,
|
||||
server_args,
|
||||
use_omni=True,
|
||||
env_dict={"OMNIVOICE_CUDA_GRAPH": "0"},
|
||||
) as server:
|
||||
response = requests.post(
|
||||
f"http://{server.host}:{server.port}/v1/audio/speech",
|
||||
json=payload,
|
||||
timeout=600,
|
||||
)
|
||||
response.raise_for_status()
|
||||
assert response.content.startswith(b"RIFF")
|
||||
return response.content
|
||||
|
||||
|
||||
def _generate_with_graph(server_args: list[str]) -> bytes:
|
||||
with OmniServer(
|
||||
MODEL,
|
||||
server_args,
|
||||
use_omni=True,
|
||||
) as server:
|
||||
response = requests.post(
|
||||
f"http://{server.host}:{server.port}/v1/audio/speech",
|
||||
json=payload,
|
||||
timeout=600,
|
||||
)
|
||||
response.raise_for_status()
|
||||
assert response.content.startswith(b"RIFF")
|
||||
return response.content
|
||||
|
||||
|
||||
def _common_args() -> list[str]:
|
||||
"""Return the shared B=1 server arguments for parity tests."""
|
||||
return [
|
||||
"--trust-remote-code",
|
||||
"--disable-log-stats",
|
||||
"--deploy-config",
|
||||
STAGE_CONFIG,
|
||||
"--max-num-seqs",
|
||||
"1",
|
||||
]
|
||||
|
||||
|
||||
@hardware_test(res={"cuda": "L4"}, num_cards=1)
|
||||
def test_request_mode_and_step_execution_b1_parity_without_graph() -> None:
|
||||
"""B=1 eager request and step modes must produce identical seeded WAV bytes."""
|
||||
common_args = _common_args()
|
||||
|
||||
request_audio = _generate_without_graph(common_args)
|
||||
step_audio = _generate_without_graph([*common_args, "--step-execution", "--enforce-eager"])
|
||||
|
||||
assert request_audio == step_audio
|
||||
|
||||
|
||||
@hardware_test(res={"cuda": "L4"}, num_cards=1)
|
||||
def test_request_mode_and_step_execution_b1_parity_with_graph() -> None:
|
||||
"""B=1 Graph request and step modes must produce identical seeded WAV bytes."""
|
||||
common_args = _common_args()
|
||||
|
||||
request_audio = _generate_with_graph(common_args)
|
||||
step_audio = _generate_with_graph([*common_args, "--step-execution", "--enforce-eager"])
|
||||
|
||||
assert request_audio == step_audio
|
||||
Reference in new issue
Block a user