[CI/Build] Fix MOSS CPU tests on ROCm workers (#8447)
Signed-off-by: andyluo7 <andy.luo@amd.com>
This commit is contained in:
1 parent
3bc3f1a7d0
commit
ee8fdab1dc
3 files changed
+32
-21
No files matched your search
@@ -8,8 +8,9 @@ import pytest
|
|||||||
|
|
||||||
from tests.helpers.stage_config import get_deploy_config_path
|
from tests.helpers.stage_config import get_deploy_config_path
|
||||||
from vllm_omni.config.pipeline_registry import resolve_pipeline_config
|
from vllm_omni.config.pipeline_registry import resolve_pipeline_config
|
||||||
from vllm_omni.config.stage_config import _apply_platform_overrides, load_deploy_config, merge_pipeline_deploy
|
from vllm_omni.config.stage_config import load_deploy_config, merge_pipeline_deploy
|
||||||
from vllm_omni.core.sched.omni_generation_scheduler import OmniGenerationScheduler, VLLMScheduler
|
from vllm_omni.core.sched.omni_generation_scheduler import OmniGenerationScheduler, VLLMScheduler
|
||||||
|
from vllm_omni.platforms import current_omni_platform
|
||||||
|
|
||||||
pytestmark = [pytest.mark.core_model, pytest.mark.cpu]
|
pytestmark = [pytest.mark.core_model, pytest.mark.cpu]
|
||||||
|
|
||||||
@@ -45,10 +46,14 @@ def _config(*, native=True, stateful=True, tp=1, pp=1, extras=None, capacity=128
|
|||||||
|
|
||||||
@pytest.mark.parametrize("profile", ["high_concurrency", "low_latency"])
|
@pytest.mark.parametrize("profile", ["high_concurrency", "low_latency"])
|
||||||
@pytest.mark.parametrize("platform", ["cuda", "npu", "xpu", "rocm", "musa"])
|
@pytest.mark.parametrize("platform", ["cuda", "npu", "xpu", "rocm", "musa"])
|
||||||
def test_moss_profile_generation_constructor_after_platform_resolution(construct_scheduler, mocker, profile, platform):
|
def test_moss_profile_generation_constructor_after_platform_resolution(
|
||||||
deploy = _apply_platform_overrides(
|
construct_scheduler, monkeypatch, mocker, profile, platform
|
||||||
load_deploy_config(get_deploy_config_path(f"moss_tts_local_mrv2_{profile}.yaml")), platform=platform
|
):
|
||||||
)
|
# merge_pipeline_deploy owns platform resolution. Mock the detected device
|
||||||
|
# instead of applying an override first and then resolving the worker's
|
||||||
|
# actual platform a second time.
|
||||||
|
monkeypatch.setattr(current_omni_platform, "device_name", platform)
|
||||||
|
deploy = load_deploy_config(get_deploy_config_path(f"moss_tts_local_mrv2_{profile}.yaml"))
|
||||||
pipeline = resolve_pipeline_config("moss_tts_local")
|
pipeline = resolve_pipeline_config("moss_tts_local")
|
||||||
codec = merge_pipeline_deploy(pipeline, deploy)[1]
|
codec = merge_pipeline_deploy(pipeline, deploy)[1]
|
||||||
extras = deploy.connectors["shm"]["extra"]
|
extras = deploy.connectors["shm"]["extra"]
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ single-flight, and micro-batched encoding."""
|
|||||||
import asyncio
|
import asyncio
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
|
from tempfile import TemporaryDirectory
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import torch
|
import torch
|
||||||
@@ -650,22 +651,25 @@ async def test_inline_index_requires_matching_resolve_key(make_encoder):
|
|||||||
assert audio.resolve_calls == [ref, ref]
|
assert audio.resolve_calls == [ref, ref]
|
||||||
|
|
||||||
|
|
||||||
async def test_inline_reference_shared_across_encoders(make_encoder, tmp_path_factory, monkeypatch):
|
async def test_inline_reference_shared_across_encoders(make_encoder, monkeypatch):
|
||||||
shared_dir = tmp_path_factory.mktemp("ref")
|
# Keep the AF_UNIX socket path independent of pytest's nested base path.
|
||||||
monkeypatch.setenv("VLLM_OMNI_MOSS_REF_CODES_SHARED_DIR", str(shared_dir))
|
with TemporaryDirectory(prefix="moss-ref-") as shared_dir:
|
||||||
ref = "data:audio/wav;base64,R0hJ"
|
monkeypatch.setenv("VLLM_OMNI_MOSS_REF_CODES_SHARED_DIR", shared_dir)
|
||||||
first_audio, second_audio = _DigestAudio(), _DigestAudio()
|
ref = "data:audio/wav;base64,R0hJ"
|
||||||
first_audio.register(ref, 9)
|
first_audio, second_audio = _DigestAudio(), _DigestAudio()
|
||||||
second_audio.register(ref, 9)
|
first_audio.register(ref, 9)
|
||||||
first, second = make_encoder(_FakeProcessor()), make_encoder(_FakeProcessor())
|
second_audio.register(ref, 9)
|
||||||
|
first, second = make_encoder(_FakeProcessor()), make_encoder(_FakeProcessor())
|
||||||
|
|
||||||
a, key_a = await first.encode(ref, resolve_ref_audio=first_audio.resolve, get_artifact_key=first_audio.artifact_key)
|
a, key_a = await first.encode(
|
||||||
b, key_b = await second.encode(
|
ref, resolve_ref_audio=first_audio.resolve, get_artifact_key=first_audio.artifact_key
|
||||||
ref, resolve_ref_audio=second_audio.resolve, get_artifact_key=second_audio.artifact_key
|
)
|
||||||
)
|
b, key_b = await second.encode(
|
||||||
|
ref, resolve_ref_audio=second_audio.resolve, get_artifact_key=second_audio.artifact_key
|
||||||
|
)
|
||||||
|
|
||||||
assert first_audio.resolve_calls == [ref] and second_audio.resolve_calls == []
|
assert first_audio.resolve_calls == [ref] and second_audio.resolve_calls == []
|
||||||
assert key_a == key_b and torch.equal(a, b)
|
assert key_a == key_b and torch.equal(a, b)
|
||||||
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------------- #
|
# --------------------------------------------------------------------------- #
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
"""API processes share one reference encoder through a Unix socket."""
|
"""API processes share one reference encoder through a Unix socket."""
|
||||||
|
|
||||||
import threading
|
import threading
|
||||||
|
from tempfile import TemporaryDirectory
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import torch
|
import torch
|
||||||
@@ -30,10 +31,11 @@ class _Recorder:
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def host_dir(tmp_path_factory, monkeypatch):
|
def host_dir(monkeypatch):
|
||||||
monkeypatch.setattr(shared, "_host_lock_handle", None)
|
monkeypatch.setattr(shared, "_host_lock_handle", None)
|
||||||
# AF_UNIX limits the full socket path, including pytest directory names.
|
# AF_UNIX limits the full socket path, including pytest directory names.
|
||||||
return str(tmp_path_factory.mktemp("ref"))
|
with TemporaryDirectory(prefix="moss-ref-") as path:
|
||||||
|
yield path
|
||||||
|
|
||||||
|
|
||||||
def test_only_one_process_per_directory_hosts(host_dir):
|
def test_only_one_process_per_directory_hosts(host_dir):
|
||||||
|
|||||||
Reference in new issue
Block a user