[CI][ROCm] Shorten the blocking CosyVoice test path (#7748)

Signed-off-by: andyluo7 <andy.luo@amd.com>
This commit is contained in:
andyluo7 authored and GitHub committed 2026-09-21 18:34:40 -07:00
1 parent cb31e0774f
commit 1586c41ae4
6 files changed
+111 -12

No files matched your search

@@ -260,6 +260,37 @@ class TestDiTAttention:
assert attention.to_k.out_features == 512
assert attention.to_v.out_features == 512
def test_embedded_dit_honors_diffusion_attention_backend(self, monkeypatch):
"""The LLM-hosted code2wav DiT must consume the diffusion env override."""
from vllm_omni.diffusion.config import get_current_diffusion_config_or_none
from vllm_omni.model_executor.models.cosyvoice3.cosyvoice3_code2wav import _build_dit_estimator
monkeypatch.setenv("DIFFUSION_ATTENTION_BACKEND", "TORCH_SDPA")
estimator = _build_dit_estimator(
{
"dim": 32,
"depth": 1,
"heads": 2,
"dim_head": 16,
"dropout": 0.0,
"ff_mult": 2,
"mel_dim": 8,
"mu_dim": 8,
"spk_dim": 4,
"out_channels": 8,
"static_chunk_size": 4,
"num_decoding_left_chunks": 1,
}
)
attention = estimator.transformer_blocks[0].attn.attn
assert attention.backend_pref == "TORCH_SDPA"
assert attention.backend_explicit is True
assert attention.attn_backend is not None
assert attention.attn_backend.get_name() == "SDPA"
assert get_current_diffusion_config_or_none() is None
@pytest.mark.core_model
@pytest.mark.cpu
def test_forward_passes_2d_mask_without_casting_qkv(self):
@@ -39,7 +39,10 @@ CHUNK_LEN = 24
TOTAL_MEL = 96
SPM = 480 # samples per mel frame for the small test HiFT (8*5*3*4), matching the real model
LONG_TOTAL_MEL = 400 # long enough that the 64-frame window actually truncates
WINDOW_LEN = 64
# Six chunks exercise three updates after history exceeds the bounded window,
# without spending minutes recomputing an unnecessarily long synthetic signal.
LONG_TOTAL_MEL = 144
PCM16_LSB = 1.0 / 32767.0 # smallest representable PCM16 difference
# Worst observed deviation is 1.97e-7 (~2x float32 eps); atol=1e-6 keeps 5x headroom.
@@ -189,16 +192,19 @@ def test_incremental_hift_bounded_window_is_close(config):
def test_incremental_hift_matches_streaming_reference_within_tolerance(config):
"""Windowed output matches the full-cumulative reference within float32 rounding.
The load-bearing correctness test: 400 mel frames far exceeds the 64-frame
window, so truncation genuinely exercises the phase/noise carry. Float64
agrees to ~1e-16, confirming the residual here is rounding, not truncation.
The load-bearing correctness test crosses the 64-frame window repeatedly,
so truncation genuinely exercises the phase/noise carry. Float64 agrees to
~1e-16, confirming the residual here is rounding, not truncation.
"""
hift = _make_hift(config)
model = _make_model(hift, window_len=64) # the real _hift_window_len
model = _make_model(hift, window_len=WINDOW_LEN) # the real _hift_window_len
chunks = _chunks(total_mel=LONG_TOTAL_MEL)
trim = int(hift.f0_predictor.condnet[0].causal_padding)
assert LONG_TOTAL_MEL > 64 + trim + CHUNK_LEN # window must actually truncate
truncating_steps = sum(
history_len > WINDOW_LEN + trim for history_len in range(CHUNK_LEN, LONG_TOTAL_MEL, CHUNK_LEN)
)
assert truncating_steps >= 3 # exercise repeated truncation, not only the boundary
full = _full_reference(model, chunks)
incr = _incremental(model, chunks)