forked from vllm-project/vllm
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Support for compressed-tensors
#159
Open
dbogunowicz
wants to merge
18
commits into
main
Choose a base branch
from
feature/damian/support_compression
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
39fcb11
initial commit
dbogunowicz c97fde6
ruff
dbogunowicz 7c21857
Merge branch 'main' into feature/damian/support_compression
dbogunowicz 94aaf9b
testing
dbogunowicz 6567b48
Merge remote-tracking branch 'origin/main' into feature/damian/suppor…
dbogunowicz aba6834
Merge remote-tracking branch 'origin/main' into feature/damian/suppor…
dbogunowicz eed5123
finish up
37b22ec
Merge branch 'main' into feature/damian/support_compression
dbogunowicz 3bdca69
add mapping from config to sparsity_structure
3af0404
Update vllm/config.py
dbogunowicz 59b1577
Update vllm/config.py
dbogunowicz 54d504c
Update vllm/config.py
dbogunowicz ac66cd6
michaels comments
118d82a
lets trigger GHA just for kicks
185ff9b
formatting
0c6a2d5
improve tests and refactor the code
1fda4fc
Merge branch 'main' into feature/damian/support_compression
dbogunowicz 13a1f5b
rebase
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
"""Compare the outputs from identical models: | ||
- one that is loaded from uncompressed safetensors | ||
- one that is loaded form `compressed-tensors`. | ||
The expectation is for the inference result in same | ||
behavior | ||
""" | ||
import pytest | ||
from typing import Tuple | ||
from compare_utils import check_logprobs_close | ||
|
||
MODEL_MAX_LEN = 1024 | ||
|
||
# pair of same models with compressed and ordinary safetensors | ||
MODELS = [ | ||
("neuralmagic/llama2.c-stories110M-pruned50", # uncompressed | ||
"dtransposed/llama2.c-stories110M-pruned50-compressed-tensors") # compressed | ||
] | ||
|
||
@pytest.mark.parametrize("model_pair", MODELS) | ||
@pytest.mark.parametrize("dtype", ["float16"]) | ||
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. Why remove bfloat16 here? |
||
@pytest.mark.parametrize("max_tokens", [32]) | ||
@pytest.mark.parametrize("num_logprobs", [3]) | ||
def test_models( | ||
vllm_runner_nm, | ||
example_prompts, | ||
model_pair: Tuple[str, str], | ||
dtype: str, | ||
max_tokens: int, | ||
num_logprobs: int, | ||
) -> None: | ||
|
||
model_uncompressed, model_compressed = model_pair | ||
|
||
|
||
vllm_model_0 = vllm_runner_nm(model_uncompressed, | ||
dtype=dtype, | ||
max_model_len=MODEL_MAX_LEN) | ||
|
||
vllm_outputs_0 = vllm_model_0.generate_greedy_logprobs(example_prompts, | ||
max_tokens, | ||
num_logprobs) | ||
|
||
del vllm_model_0 | ||
|
||
vllm_model_1 = vllm_runner_nm(model_compressed , | ||
dtype=dtype, | ||
max_model_len=MODEL_MAX_LEN) | ||
|
||
vllm_outputs_1 = vllm_model_1.generate_greedy_logprobs(example_prompts, | ||
max_tokens, | ||
num_logprobs) | ||
|
||
del vllm_model_1 | ||
|
||
# loop through the prompts | ||
check_logprobs_close( | ||
outputs_0_lst=vllm_outputs_0, | ||
outputs_1_lst=vllm_outputs_1, | ||
name_0="vllm_model_from_uncompressed_weights", | ||
name_1="vllm_model_from_compressed_weights", | ||
) |
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
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.
will move this model to neuralmagic repo before landing