[Config] Disable Async Chunk for Unsupported Pipelines (#5099)
Signed-off-by: Alex Brooks <albrooks@redhat.com>
This commit is contained in:
1 parent
1ea0ee3b38
commit
764a109f66
5 files changed
+273
-129
No files matched your search
@@ -1405,6 +1405,21 @@ class TestDeployConfigLoading:
|
||||
with pytest.raises(ValueError, match=r"stage_args.*PipelineConfig.*stages"):
|
||||
load_deploy_config(deploy_path)
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("yaml_val", "expected"),
|
||||
[
|
||||
('"2"', 2),
|
||||
('""', 0),
|
||||
("null", 0),
|
||||
],
|
||||
)
|
||||
def test_coerces_active_stream_window_to_int(self, tmp_path, yaml_val, expected):
|
||||
"""Ensure active stream window coerces str to int."""
|
||||
deploy_path = tmp_path / "deploy.yaml"
|
||||
deploy_path.write_text(f"active_stream_window: {yaml_val}\n", encoding="utf-8")
|
||||
deploy = load_deploy_config(deploy_path)
|
||||
assert deploy.active_stream_window == expected
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("filename", "max_sessions"),
|
||||
[
|
||||
@@ -3511,14 +3526,10 @@ class TestSentinelDefaultPrecedence:
|
||||
assert stage1.sync_process_input_func is not None
|
||||
assert stage1.sync_process_input_func.endswith("thinker2talker_token_only")
|
||||
|
||||
# async_chunk=True must now be rejected: removing the fake hook means
|
||||
# there is no next-stage input processor for the validator to accept.
|
||||
# (Positive consequence -- users can't accidentally enable async_chunk
|
||||
# on an arch that doesn't actually support it.)
|
||||
import pytest as _pytest
|
||||
|
||||
with _pytest.raises(ValueError, match="async_chunk=True"):
|
||||
merge_pipeline_deploy(pipeline, DeployConfig(async_chunk=True))
|
||||
# ensure merging the pipeline deploy with async chunk set to True disables it,
|
||||
# since currently it is not supported for this pipeline.
|
||||
stage_configs = merge_pipeline_deploy(pipeline, DeployConfig(async_chunk=True))
|
||||
assert all([not stg_cfg.yaml_engine_args["async_chunk"] for stg_cfg in stage_configs])
|
||||
|
||||
# async_chunk=False merges cleanly and stage-0 yaml_engine_args carries
|
||||
# no spurious full-payload hook.
|
||||
@@ -3687,3 +3698,71 @@ class TestObjectStorageConfigResolution:
|
||||
|
||||
matching = "s3://any-bucket/my-cosyvoice3-model"
|
||||
assert StageConfigFactory.try_infer_model_type(model=matching, trust_remote_code=False) == "cosyvoice3"
|
||||
|
||||
|
||||
class TestAsyncChunkDefaults:
|
||||
def test_async_chunk_auto_disabled_without_processor(self):
|
||||
"""Ensure a multi-stage model that doesn't support async chunk turns it off by default."""
|
||||
pipeline = PipelineConfig(
|
||||
model_type="test_no_async",
|
||||
model_arch="TestNoAsync",
|
||||
stages=(
|
||||
StagePipelineConfig(
|
||||
stage_id=0,
|
||||
model_stage="ar",
|
||||
execution_type=StageExecutionType.LLM_AR,
|
||||
final_output=True,
|
||||
),
|
||||
StagePipelineConfig(
|
||||
stage_id=1,
|
||||
model_stage="generation",
|
||||
execution_type=StageExecutionType.LLM_GENERATION,
|
||||
input_sources=(0,),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
deploy = DeployConfig()
|
||||
# async chunk should not try to default to True in this case,
|
||||
# since doing so will just raise a ValueError in validation.
|
||||
merge_pipeline_deploy(pipeline, deploy)
|
||||
assert not deploy.async_chunk
|
||||
|
||||
def test_async_chunk_auto_disabled_when_yaml_omits_key(self, tmp_path):
|
||||
"""Ensure a multi-stage model that doesn't support async chunk turns it off by default
|
||||
when a deploy config is provided that doesn't explicitly set it."""
|
||||
|
||||
deploy_path = tmp_path / "no_async_chunk.yaml"
|
||||
deploy_path.write_text(
|
||||
"""
|
||||
stages:
|
||||
- stage_id: 0
|
||||
devices: "0"
|
||||
- stage_id: 1
|
||||
devices: "0"
|
||||
""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
deploy = load_deploy_config(deploy_path)
|
||||
|
||||
pipeline = PipelineConfig(
|
||||
model_type="test_no_async",
|
||||
model_arch="TestNoAsync",
|
||||
stages=(
|
||||
StagePipelineConfig(
|
||||
stage_id=0,
|
||||
model_stage="ar",
|
||||
execution_type=StageExecutionType.LLM_AR,
|
||||
final_output=True,
|
||||
),
|
||||
StagePipelineConfig(
|
||||
stage_id=1,
|
||||
model_stage="generation",
|
||||
execution_type=StageExecutionType.LLM_GENERATION,
|
||||
input_sources=(0,),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
merge_pipeline_deploy(pipeline, deploy)
|
||||
assert not deploy.async_chunk
|
||||
Reference in new issue
Block a user