[Frontend] Tune reference cache limits and registered MOSS voice requests (#7883)
Signed-off-by: Canlin Guo <canlinguosdu@gmail.com>
This commit is contained in:
1 parent
1c1fdf719c
commit
235c430326
22 files changed
+752
-70
No files matched your search
@@ -366,6 +366,8 @@ class _FakeSocket:
|
||||
|
||||
|
||||
class _FakeEngineClient:
|
||||
config_path: str | None = None
|
||||
|
||||
def __init__(self, *, stage_configs=None, endpoint_restrictions=None, vllm_config=None) -> None:
|
||||
self.stage_configs = stage_configs if stage_configs is not None else []
|
||||
self.endpoint_restrictions = endpoint_restrictions if endpoint_restrictions is not None else {}
|
||||
@@ -999,9 +1001,14 @@ async def test_pure_diffusion_app_state_key_snapshot(monkeypatch) -> None:
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_pure_diffusion_speech_forwards_media_access_args(monkeypatch) -> None:
|
||||
async def test_pure_diffusion_speech_forwards_media_access_args(monkeypatch, tmp_path) -> None:
|
||||
stage = SimpleNamespace(stage_type="diffusion", engine_args={})
|
||||
engine = _FakeEngineClient(stage_configs=[stage])
|
||||
base = tmp_path / "base.yaml"
|
||||
base.write_text("speech_cache:\n resolve_max_bytes: 1234\n speaker_max_bytes: 0\n")
|
||||
deploy = tmp_path / "deploy.yaml"
|
||||
deploy.write_text("base_config: base.yaml\nspeech_cache:\n resolve_max_entries: 17\n")
|
||||
engine.config_path = str(deploy)
|
||||
speech_kwargs = {}
|
||||
|
||||
def _for_diffusion_factory(label: str):
|
||||
@@ -1042,10 +1049,14 @@ async def test_pure_diffusion_speech_forwards_media_access_args(monkeypatch) ->
|
||||
|
||||
assert speech_kwargs["allowed_local_media_path"] == "/allowed/media"
|
||||
assert speech_kwargs["allowed_media_domains"] == ["media.example.com"]
|
||||
config = speech_kwargs["speech_cache_config"]
|
||||
assert config.resolve_max_bytes == 1234
|
||||
assert config.resolve_max_entries == 17
|
||||
assert config.speaker_max_bytes == 0
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_multistage_app_state_key_snapshot(monkeypatch) -> None:
|
||||
async def test_multistage_app_state_key_snapshot(monkeypatch, tmp_path) -> None:
|
||||
"""Lock multi-stage ``app.state`` keys after init, including live vs None.
|
||||
|
||||
Fails if chat/speech/video/realtime/tokenization keys disappear or are
|
||||
@@ -1075,7 +1086,15 @@ async def test_multistage_app_state_key_snapshot(monkeypatch) -> None:
|
||||
def warmup(self):
|
||||
return None
|
||||
|
||||
deploy = tmp_path / "deploy.yaml"
|
||||
deploy.write_text("speech_cache:\n resolve_max_bytes: 1024\n speaker_max_bytes: 8\n")
|
||||
engine.config_path = str(deploy)
|
||||
speech_kwargs = {}
|
||||
|
||||
class _FakeSpeech(_FakeCtor):
|
||||
def __init__(self, *args, **kwargs):
|
||||
speech_kwargs.update(kwargs)
|
||||
|
||||
async def warmup(self):
|
||||
return None
|
||||
|
||||
@@ -1104,6 +1123,9 @@ async def test_multistage_app_state_key_snapshot(monkeypatch) -> None:
|
||||
|
||||
state = State()
|
||||
await api_server.omni_init_app_state(engine, state, _minimal_args())
|
||||
assert speech_kwargs["speech_cache_config"].resolve_max_bytes == 1024
|
||||
assert speech_kwargs["speech_cache_config"].resolve_max_entries == 2048
|
||||
assert speech_kwargs["speech_cache_config"].speaker_max_bytes == 8
|
||||
|
||||
_assert_app_state_snapshot(
|
||||
state,
|
||||
|
||||
Reference in new issue
Block a user