Skip to content

Commit 0943f09

Browse files
committed
comments addressed
Signed-off-by: Amit Raj <[email protected]>
1 parent 92638d7 commit 0943f09

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

tests/vllm/test_qaic_output_consistency.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
DECOE_BSZ = 4
2222
DTYPE = "mxfp6"
2323
KV_DTYPE = "mxint8"
24-
DEVICE_GROUP = [0]
2524

2625

2726
@pytest.mark.vllm
@@ -43,7 +42,6 @@ def test_output_consistency(model_name):
4342
# Creating LLM Object
4443
qllm = LLM(
4544
model=model_name,
46-
device_group=DEVICE_GROUP,
4745
max_num_seqs=DECOE_BSZ,
4846
max_model_len=CTX_LEN,
4947
max_seq_len_to_capture=SEQ_LEN,
@@ -53,17 +51,20 @@ def test_output_consistency(model_name):
5351
)
5452

5553
# Single prompt test
56-
prompt1 = ["My name is"]
54+
single_prompt = ["My name is"]
5755

58-
output1 = qllm.generate(prompt1 * 5, sampling_params)
56+
single_prompt_output = qllm.generate(single_prompt * 5, sampling_params)
5957

60-
check_output1 = []
61-
for i, op in enumerate(output1):
62-
check_output1.append(op.outputs[0].text)
58+
check_output = []
59+
for i, op in enumerate(single_prompt_output):
60+
check_output.append(op.outputs[0].text)
61+
62+
# Assertion to check the consistency of single prompt.
63+
assert len(set(check_output)) == 1, "Outputs from different slots for same prompt does not match!!"
6364

6465
# Multiple prompt test
6566
outputDict = dict()
66-
prompt2 = [
67+
multiple_prompt = [
6768
"My name is",
6869
"How to eat mangosteen?",
6970
"How many people died in World War II",
@@ -80,22 +81,21 @@ def test_output_consistency(model_name):
8081
"Where is Statue of Liberty located?",
8182
]
8283

83-
for p in prompt2:
84+
for p in multiple_prompt:
8485
outputDict[p] = []
8586

8687
for _ in range(5):
87-
random.shuffle(prompt2)
88-
output2 = qllm.generate(prompt2, sampling_params)
89-
for i, op in enumerate(output2):
88+
random.shuffle(multiple_prompt)
89+
multiple_prompt_output = qllm.generate(multiple_prompt, sampling_params)
90+
for i, op in enumerate(multiple_prompt_output):
9091
generated_text = op.outputs[0].text
91-
outputDict[prompt2[i]].append(str(prompt2[i] + generated_text))
92-
93-
# Assertion to check the consistency of single prompt.
94-
assert len(set(check_output1)) == 1, "Outputs from different slots for same prompt does not match!!"
92+
outputDict[multiple_prompt[i]].append(str(multiple_prompt[i] + generated_text))
9593

9694
# Assertion to check multiple prompts.
9795
for key in outputDict.keys():
9896
assert len(set(outputDict[key])) == 1, "Outputs from different slots for same prompt does not match!!"
9997

10098
# Assertion to check if any prompts are missed.
101-
assert len(prompt2) == len(output2), "Number of Generated Tokens do not match the number of valid inputs!!"
99+
assert len(multiple_prompt) == len(multiple_prompt_output), (
100+
"Number of Generated Tokens do not match the number of valid inputs!!"
101+
)

0 commit comments

Comments
 (0)