generated from fastai/nbdev_template
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Update vLLM version support to include 0.14.0 and 0.14.1 #5214
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ | |
| from types import SimpleNamespace | ||
|
|
||
| import pytest | ||
| from packaging.version import Version | ||
| from transformers import AutoModelForCausalLM, AutoTokenizer | ||
| from transformers.testing_utils import torch_device | ||
|
|
||
|
|
@@ -35,8 +36,13 @@ | |
|
|
||
|
|
||
| if is_vllm_available(): | ||
| import vllm | ||
| from vllm import LLM, SamplingParams | ||
|
|
||
| _is_vllm_ge_014 = Version(vllm.__version__) >= Version("0.14.0") | ||
| else: | ||
| _is_vllm_ge_014 = False | ||
|
|
||
|
|
||
| class TestChunkList(TrlTestCase): | ||
| def test_even_split(self): | ||
|
|
@@ -530,6 +536,26 @@ def multiply(a: int, b: int) -> int: | |
| decoded_prompt = tokenizer.decode(outputs["prompt_ids"][0]) | ||
| assert "Multiplies two integers." in decoded_prompt | ||
|
|
||
| def test_generate_with_params(self): | ||
| prompts = ["Hello, AI!", "Tell me a joke"] | ||
| completion_ids = self.client.generate(prompts, n=2, repetition_penalty=0.9, temperature=0.8, max_tokens=32)[ | ||
| "completion_ids" | ||
| ] | ||
|
|
||
| # Check that the output is a list | ||
| assert isinstance(completion_ids, list) | ||
|
|
||
| # Check that the number of generated sequences is 2 times the number of prompts | ||
| assert len(completion_ids) == 2 * len(prompts) | ||
|
|
||
| # Check that the generated sequences are lists of integers | ||
| for seq in completion_ids: | ||
| assert all(isinstance(tok, int) for tok in seq) | ||
|
|
||
| # Check that the length of the generated sequences is less than or equal to 32 | ||
| for seq in completion_ids: | ||
| assert len(seq) <= 32 | ||
|
|
||
| def test_update_model_params(self): | ||
| model = AutoModelForCausalLM.from_pretrained(self.model_id, device_map=torch_device) | ||
| self.client.update_model_params(model) | ||
|
|
@@ -549,6 +575,10 @@ def teardown_class(cls): | |
|
|
||
|
|
||
| @pytest.mark.slow | ||
| @pytest.mark.skipif( | ||
| _is_vllm_ge_014, | ||
| reason="Skipping DP server test for vLLM>=0.14.0 (PR vllm#30739: DP for non-MoE/dense models no longer supported).", | ||
| ) | ||
| @require_3_accelerators | ||
| @require_vllm | ||
| class TestVLLMClientServerDP(TrlTestCase): | ||
|
|
@@ -635,6 +665,26 @@ def multiply(a: int, b: int) -> int: | |
| decoded_prompt = tokenizer.decode(outputs["prompt_ids"][0]) | ||
| assert "Multiplies two integers." in decoded_prompt | ||
|
|
||
| def test_generate_with_params(self): | ||
| prompts = ["Hello, AI!", "Tell me a joke"] | ||
| completion_ids = self.client.generate(prompts, n=2, repetition_penalty=0.9, temperature=0.8, max_tokens=32)[ | ||
| "completion_ids" | ||
| ] | ||
|
|
||
| # Check that the output is a list | ||
| assert isinstance(completion_ids, list) | ||
|
|
||
| # Check that the number of generated sequences is 2 times the number of prompts | ||
| assert len(completion_ids) == 2 * len(prompts) | ||
|
|
||
| # Check that the generated sequences are lists of integers | ||
| for seq in completion_ids: | ||
| assert all(isinstance(tok, int) for tok in seq) | ||
|
|
||
| # Check that the length of the generated sequences is less than or equal to 32 | ||
| for seq in completion_ids: | ||
| assert len(seq) <= 32 | ||
|
|
||
|
Comment on lines
+668
to
+687
Member
Author
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. |
||
| def test_update_model_params(self): | ||
| model = AutoModelForCausalLM.from_pretrained(self.model_id, device_map=torch_device) | ||
| self.client.update_model_params(model) | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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.
not specific to vllm 0.14, but I realized that this test case was missing