This repository has been archived by the owner on Oct 11, 2024. It is now read-only.
forked from vllm-project/vllm
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make initialization of tokenizer and detokenizer optional (vllm-proje…
…ct#3748) Co-authored-by: Yun Ding <[email protected]> Co-authored-by: Roger Wang <[email protected]>
- Loading branch information
1 parent
0a07feb
commit 6804189
Showing
6 changed files
with
69 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import pytest | ||
|
||
from vllm.entrypoints.llm import LLM | ||
from vllm.sampling_params import SamplingParams | ||
|
||
|
||
@pytest.mark.parametrize("model", ["facebook/opt-125m"]) | ||
def test_skip_tokenizer_initialization(model: str): | ||
# This test checks if the flag skip_tokenizer_init skips the initialization | ||
# of tokenizer and detokenizer. The generated output is expected to contain | ||
# token ids. | ||
llm = LLM(model=model, skip_tokenizer_init=True) | ||
sampling_params = SamplingParams(prompt_logprobs=True, detokenize=True) | ||
with pytest.raises(ValueError) as err: | ||
llm.generate("abc", sampling_params) | ||
assert "prompts must be None if" in str(err.value) | ||
outputs = llm.generate(prompt_token_ids=[[1, 2, 3]], | ||
sampling_params=sampling_params) | ||
assert len(outputs) > 0 | ||
completions = outputs[0].outputs | ||
assert len(completions) > 0 | ||
assert completions[0].text == "" | ||
assert completions[0].token_ids |
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