-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
[CI/Build] Expand Model Testing #4510
Closed
Closed
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
File renamed without changes.
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,92 @@ | ||
"""Compares the outputs of hf vs vllm for medium sized models. | ||
|
||
There is not bitwise correctness for fp16 inference. | ||
As a result, in this test, we just confirm that the top selected tokens | ||
of the models are in the top 3 selections of each other. | ||
|
||
Run `pytest tests/models/test_models_medium_logprobs.py` --forked. | ||
""" | ||
import pytest | ||
|
||
from tests.models.utils import check_logprobs_close | ||
|
||
SKIPPED_MODEL_REASON = { | ||
"THUDM/chatglm3-6b": "Hf side test broken", | ||
"allenai/OLMo-1B": "Hf side requirement conflict (req torch 2.2)", | ||
"xverse/XVERSE-7B": "Hf side test broken" | ||
} | ||
|
||
MAX_MODEL_LEN = 1024 | ||
|
||
MODELS = [ | ||
"baichuan-inc/Baichuan2-7B-Chat", | ||
"bigscience/bloom-560m", | ||
"THUDM/chatglm3-6b", | ||
# command-r -> not tested | ||
# dbrx -> not tested | ||
"Deci/DeciLM-7B-instruct", | ||
"deepseek-ai/deepseek-coder-1.3b-instruct", | ||
"tiiuae/falcon-7b-instruct", | ||
"google/gemma-1.1-2b-it", | ||
"gpt2", | ||
"bigcode/tiny_starcoder_py", | ||
"EleutherAI/gpt-j-6b", | ||
"EleutherAI/pythia-1.4b", | ||
"internlm/internlm2-chat-7b", | ||
# jais -> not tested | ||
"TinyLlama/TinyLlama-1.1B-Chat-v1.0", | ||
"openbmb/MiniCPM-2B-128k", | ||
# mixtral -> not tested | ||
# mixtral-quant -> not tested | ||
"mosaicml/mpt-7b-instruct", | ||
"allenai/OLMo-1B", | ||
"facebook/opt-125m", | ||
# orion -> not tested | ||
"microsoft/phi-2", | ||
"Qwen/Qwen-1_8B", | ||
"Qwen/Qwen1.5-1.8B", | ||
# qwen2 moe -> not tested | ||
"stabilityai/stablelm-2-1_6b-chat", | ||
"bigcode/starcoder2-3b", | ||
"xverse/XVERSE-7B", | ||
] | ||
|
||
|
||
@pytest.mark.parametrize("model", MODELS) | ||
@pytest.mark.parametrize("dtype", ["half"]) | ||
@pytest.mark.parametrize("max_tokens", [32]) | ||
@pytest.mark.parametrize("num_logprobs", [5]) | ||
def test_models( | ||
vllm_runner, | ||
hf_runner, | ||
example_prompts, | ||
model, | ||
dtype: str, | ||
max_tokens: int, | ||
num_logprobs: int, | ||
) -> None: | ||
# Skip if explicitly skipped. | ||
if model in SKIPPED_MODEL_REASON: | ||
pytest.skip(reason=SKIPPED_MODEL_REASON[model]) | ||
# Run HF. | ||
hf_model = hf_runner(model_name=model, dtype=dtype) | ||
hf_outputs = hf_model.generate_greedy_logprobs_limit( | ||
example_prompts, max_tokens, num_logprobs) | ||
del hf_model | ||
|
||
# Run vLLM. | ||
vllm_model = vllm_runner(model_name=model, | ||
enforce_eager=True, | ||
dtype=dtype, | ||
max_model_len=MAX_MODEL_LEN) | ||
vllm_outputs = vllm_model.generate_greedy_logprobs(example_prompts, | ||
max_tokens, | ||
num_logprobs) | ||
del vllm_model | ||
|
||
check_logprobs_close( | ||
outputs_0_lst=hf_outputs, | ||
outputs_1_lst=vllm_outputs, | ||
name_0="hf", | ||
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Several of these left in are still tested in medium. Obviously this test is more strict as it is measuring float exact token match, but do we need to duplicate models like bloom, deepseek, starcoder?