A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 15, 18:30 UTC
[V1] Minor V1 async engine test refactor (#15075)
Signed-off-by: andoorve <murali.andoorveedu@mail.utoronto.ca> Co-authored-by: andoorve <murali.andoorveedu@mail.utoronto.ca>
Murali Andoorveedu committed
Mar 19, 2025 at 10:37 UTC
61c7a1b856e32ef8b12c70abcb9fd9ad22619a13
1 file changed
+9
-16
tests/v1/engine/test_async_llm.py
+9
-16
@@ -76,21 +76,18 @@ async def generate(engine: AsyncLLM,
76
77
@pytest.mark.parametrize(
78
"output_kind", [RequestOutputKind.DELTA, RequestOutputKind.FINAL_ONLY])
79
-@pytest.mark.parametrize("engine_args_and_prompt",
79
+@pytest.mark.parametrize("engine_args,prompt",
80
[(TEXT_ENGINE_ARGS, TEXT_PROMPT),
81
(VISION_ENGINE_ARGS, VISION_PROMPT)])
82
@pytest.mark.asyncio
83
-async def test_load(
84
- monkeypatch: pytest.MonkeyPatch,
85
- output_kind: RequestOutputKind,
86
- engine_args_and_prompt: tuple[AsyncEngineArgs, PromptType],
87
-):
83
+async def test_load(monkeypatch: pytest.MonkeyPatch,
84
+ output_kind: RequestOutputKind,
85
+ engine_args: AsyncEngineArgs, prompt: PromptType):
86
# TODO(rickyx): Remove monkeypatch once we have a better way to test V1
87
# so that in the future when we switch, we don't have to change all the
88
# tests.
89
with monkeypatch.context() as m, ExitStack() as after:
90
m.setenv("VLLM_USE_V1", "1")
93
- engine_args, prompt = engine_args_and_prompt
91
92
engine = AsyncLLM.from_engine_args(engine_args)
93
after.callback(engine.shutdown)
@@ -124,18 +121,16 @@ async def test_load(
121
122
@pytest.mark.parametrize(
123
"output_kind", [RequestOutputKind.DELTA, RequestOutputKind.FINAL_ONLY])
127
-@pytest.mark.parametrize("engine_args_and_prompt",
124
+@pytest.mark.parametrize("engine_args,prompt",
125
[(TEXT_ENGINE_ARGS, TEXT_PROMPT),
126
(VISION_ENGINE_ARGS, VISION_PROMPT)])
127
@pytest.mark.asyncio
128
async def test_abort(monkeypatch: pytest.MonkeyPatch,
129
output_kind: RequestOutputKind,
133
- engine_args_and_prompt: tuple[AsyncEngineArgs,
134
- PromptType]):
130
+ engine_args: AsyncEngineArgs, prompt: PromptType):
131
132
with monkeypatch.context() as m, ExitStack() as after:
133
m.setenv("VLLM_USE_V1", "1")
138
- engine_args, prompt = engine_args_and_prompt
134
135
engine = AsyncLLM.from_engine_args(engine_args)
136
after.callback(engine.shutdown)
@@ -193,17 +188,15 @@ async def test_abort(monkeypatch: pytest.MonkeyPatch,
188
189
190
@pytest.mark.parametrize("n", [1, 3])
196
-@pytest.mark.parametrize("engine_args_and_prompt",
191
+@pytest.mark.parametrize("engine_args,prompt",
192
[(TEXT_ENGINE_ARGS, TEXT_PROMPT),
193
(VISION_ENGINE_ARGS, VISION_PROMPT)])
194
@pytest.mark.asyncio
200
-async def test_finished_flag(monkeypatch, n: int,
201
- engine_args_and_prompt: tuple[AsyncEngineArgs,
202
- PromptType]):
195
+async def test_finished_flag(monkeypatch: pytest.MonkeyPatch, n: int,
196
+ engine_args: AsyncEngineArgs, prompt: PromptType):
197
198
with monkeypatch.context() as m, ExitStack() as after:
199
m.setenv("VLLM_USE_V1", "1")
206
- engine_args, prompt = engine_args_and_prompt
200
201
engine = AsyncLLM.from_engine_args(engine_args)
202
after.callback(engine.shutdown)