forked from vllm-project/vllm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ CI/Build ] Added E2E Test For Compressed Tensors (vllm-project#5839)
Co-authored-by: Michael Goin <michael@neuralmagic.com> Co-authored-by: Robert Shaw <rshaw@neuralmagic>
- Loading branch information
1 parent
0885ee7
commit 7d508d8
Showing
4 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
"""Compares vllm vs sparseml for compressed-tensors | ||
Note: vllm and sparseml do not have bitwise correctness, | ||
so in this test, we just confirm that the top selected | ||
tokens of the are in the top 5 selections of each other. | ||
""" | ||
|
||
import pytest | ||
|
||
from tests.quantization.utils import is_quant_method_supported | ||
|
||
from .utils import check_logprobs_close | ||
|
||
MODELS = [ | ||
"nm-testing/Meta-Llama-3-8B-Instruct-W8-Channel-A8-Dynamic-Per-Token-Test", | ||
] | ||
|
||
MAX_TOKENS = 32 | ||
NUM_LOGPROBS = 5 | ||
|
||
|
||
@pytest.mark.skipif( | ||
not is_quant_method_supported("compressed-tensors"), | ||
reason="compressed-tensors is not supported on this machine type.") | ||
@pytest.mark.parametrize("model_name", MODELS) | ||
def test_models( | ||
vllm_runner, | ||
hf_runner, | ||
example_prompts, | ||
model_name, | ||
) -> None: | ||
# Run sparseml. | ||
with hf_runner(model_name=model_name, | ||
is_sparseml_model=True) as sparseml_model: | ||
|
||
sparseml_outputs = sparseml_model.generate_greedy_logprobs_limit( | ||
example_prompts, MAX_TOKENS, NUM_LOGPROBS) | ||
|
||
# Run vllm. | ||
with vllm_runner(model_name=model_name) as vllm_model: | ||
vllm_outputs = vllm_model.generate_greedy_logprobs( | ||
example_prompts, MAX_TOKENS, NUM_LOGPROBS) | ||
|
||
check_logprobs_close( | ||
outputs_0_lst=sparseml_outputs, | ||
outputs_1_lst=vllm_outputs, | ||
name_0="sparseml", | ||
name_1="vllm", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters