-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[v1] EngineArgs for better config handling for v1 (#10382)
Signed-off-by: rickyx <[email protected]>
- Loading branch information
Showing
13 changed files
with
109 additions
and
27 deletions.
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,42 @@ | ||
import pytest | ||
|
||
from vllm import envs | ||
from vllm.config import VllmConfig | ||
from vllm.engine.arg_utils import EngineArgs | ||
from vllm.usage.usage_lib import UsageContext | ||
|
||
if not envs.VLLM_USE_V1: | ||
pytest.skip( | ||
"Skipping V1 tests. Rerun with `VLLM_USE_V1=1` to test.", | ||
allow_module_level=True, | ||
) | ||
|
||
|
||
def test_defaults(): | ||
engine_args = EngineArgs(model="facebook/opt-125m") | ||
|
||
# Assert V1 defaults | ||
assert (engine_args.enable_prefix_caching | ||
), "V1 turns on prefix caching by default" | ||
|
||
|
||
def test_defaults_with_usage_context(): | ||
engine_args = EngineArgs(model="facebook/opt-125m") | ||
vllm_config: VllmConfig = engine_args.create_engine_config( | ||
UsageContext.LLM_CLASS) | ||
|
||
assert vllm_config.scheduler_config.max_num_seqs == 1024 | ||
assert vllm_config.scheduler_config.max_num_batched_tokens == 8192 | ||
|
||
engine_args = EngineArgs(model="facebook/opt-125m") | ||
vllm_config = engine_args.create_engine_config( | ||
UsageContext.OPENAI_API_SERVER) | ||
assert vllm_config.scheduler_config.max_num_seqs == 1024 | ||
assert vllm_config.scheduler_config.max_num_batched_tokens == 2048 | ||
|
||
|
||
def test_prefix_cache_disabled_with_multimodel(): | ||
engine_args = EngineArgs(model="llava-hf/llava-1.5-7b-hf") | ||
|
||
vllm_config = engine_args.create_engine_config(UsageContext.LLM_CLASS) | ||
assert not vllm_config.cache_config.enable_prefix_caching |
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
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
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
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