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 7, 02:45 UTC
[ROCm][CI] Accept Different But Valid Output for `test_olmoe_tp` (#35224)
Micah Williamson committed
Mar 7, 2026 at 15:50 UTC
ee54f9cdb91f04350bba0cf11890b02b12c62baa
1 file changed
+20
-5
tests/lora/test_olmoe_tp.py
+20
-5
@@ -3,6 +3,7 @@
3
4
5
import shutil
6
+from collections.abc import Sequence
7
8
import pytest
9
import torch
@@ -15,7 +16,7 @@ from ..utils import multi_gpu_test
16
17
MODEL_PATH = "allenai/OLMoE-1B-7B-0125-Instruct"
18
18
-PROMPT_TEMPLATE = """I want you to act as a SQL terminal in front of an example database, you need only to return the sql command to me.Below is an instruction that describes a task, Write a response that appropriately completes the request.
19
+PROMPT_TEMPLATE = """I want you to act as a SQL terminal in front of an example database, you need only to return the sql command to me. Do not return any additional explanation. Below is an instruction that describes a task, Write a response that appropriately completes the request.
20
"
21
##Instruction:
22
candidate_poll contains tables such as candidate, people. Table candidate has columns such as Candidate_ID, People_ID, Poll_Source, Date, Support_rate, Consider_rate, Oppose_rate, Unsure_rate. Candidate_ID is the primary key.
@@ -39,10 +40,20 @@ EXPECTED_BASE_MODEL_OUTPUT = [
40
"SELECT COUNT(Candidate_ID) FROM candidate",
41
"SELECT COUNT(Candidate_ID) FROM candidate",
42
"SELECT Candidate_ID, COUNT(*) as Total_Candidates\nFROM candidate\nINNER JOIN people ON candidate.People_ID = people.People_ID", # noqa: E501
42
- "SELECT Candidate_ID, Poll_Source FROM candidate WHERE People_ID IN (SELECT People_ID FROM people) ORDER BY COUNT(*) DESC LIMIT 1", # noqa: E501
43
+ # There are multiple acceptable responses
44
+ (
45
+ "SELECT Candidate_ID, Poll_Source FROM candidate WHERE People_ID IN (SELECT People_ID FROM people) ORDER BY COUNT(*) DESC LIMIT 1", # noqa: E501
46
+ "SELECT Candidate_ID, Poll_Source FROM candidate WHERE COUNT(People_ID) = (SELECT COUNT(People_ID) FROM people) ORDER BY Candidate_ID DESC LIMIT 1", # noqa: E501
47
+ ),
48
]
49
50
51
+def _output_matches(generated: str, accepted: str | Sequence[str]) -> bool:
52
+ if isinstance(accepted, str):
53
+ accepted = (accepted,)
54
+ return any(generated.startswith(s) for s in accepted)
55
+
56
+
57
def generate_and_test(
58
llm: vllm.LLM,
59
lora_path: str,
@@ -90,9 +101,13 @@ def generate_and_test(
101
102
if compare_lower:
103
generated_text = generated_text.lower()
93
- expected_output = expected_output.lower()
94
-
95
- assert generated_text.startswith(expected_output)
104
+ if isinstance(expected_output, str):
105
+ expected_output = (expected_output.lower(),)
106
+ else:
107
+ expected_output = tuple(s.lower() for s in expected_output)
108
+ assert _output_matches(generated_text, expected_output), (
109
+ f"Output {i}: {generated_text!r} does not match any of {expected_output!r}"
110
+ )
111
112
113
def test_olmoe_lora(olmoe_lora_files):