-
Notifications
You must be signed in to change notification settings - Fork 2k
[https://nvbugs/5625743][test] Adding test_batch_completions_beam_sea… #9345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -204,6 +204,34 @@ async def test_batch_completions_streaming(async_client: openai.AsyncOpenAI, | |||||
| assert texts[0] == texts[1] | ||||||
|
|
||||||
|
|
||||||
| @pytest.mark.asyncio(loop_scope="module") | ||||||
| @pytest.mark.parametrize("prompts", | ||||||
| [["Hello, my name is"] * 2, [[0, 0, 0, 0, 0]] * 2]) | ||||||
| async def test_batch_completions_beam_search_streaming( | ||||||
| async_client_with_beam_search: openai.AsyncOpenAI, model_name, prompts): | ||||||
| # test beam search with streaming | ||||||
| batch = await async_client_with_beam_search.completions.create( | ||||||
| model=model_name, | ||||||
| prompt=prompts, | ||||||
| n=2, | ||||||
| max_tokens=5, | ||||||
| temperature=0.0, | ||||||
| stream=True, | ||||||
| extra_body=dict(use_beam_search=True), | ||||||
| ) | ||||||
| texts = [""] * 4 # 2 prompts × 2 beams = 4 choices | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace Unicode multiplication sign with ASCII 'x'. The comment uses Apply this diff: - texts = [""] * 4 # 2 prompts × 2 beams = 4 choices
+ texts = [""] * 4 # 2 prompts x 2 beams = 4 choicesBased on static analysis hints. 📝 Committable suggestion
Suggested change
🧰 Tools🪛 Ruff (0.14.5)222-222: Comment contains ambiguous (RUF003) 🤖 Prompt for AI Agents |
||||||
| async for chunk in batch: | ||||||
| assert len(chunk.choices) == 1 | ||||||
| choice = chunk.choices[0] | ||||||
| texts[choice.index] += choice.text | ||||||
|
|
||||||
| # Verify beam search produces different outputs for different beams | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LGTM, however https://nvbugs/5625743 does not pass So, ideally we could parametrize the test to also cover |
||||||
| assert texts[0] != texts[1], "beam search should produce different outputs" | ||||||
| # Verify the two copies of the same prompt produce the same beams | ||||||
| assert texts[0] == texts[2], "same prompt should produce same first beam" | ||||||
| assert texts[1] == texts[3], "same prompt should produce same second beam" | ||||||
|
|
||||||
|
|
||||||
| @pytest.mark.asyncio(loop_scope="module") | ||||||
| async def test_completion_stream_options(async_client: openai.AsyncOpenAI, | ||||||
| model_name: str): | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this test executed in pre-merge or post-merge? i'm trying to follow the logic through the nested ways to invoke tests - will this test end up calling it? https://github.com/NVIDIA/TensorRT-LLM/blob/main/tests/integration/defs/test_e2e.py#L1624
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's on the pre-merge pipeline.
TensorRT-LLM/tests/integration/defs/test_e2e.py
Line 1588 in 32f5391
TensorRT-LLM/tests/integration/test_lists/test-db/l0_a10.yml
Line 61 in 32f5391