forked from vllm-project/vllm
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6837825
commit 86d5e5d
Showing
3 changed files
with
67 additions
and
11 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,31 @@ | ||
""" | ||
This test file includes some cases where it is inappropriate to | ||
only get the `eos_token_id` from the tokenizer as defined by | ||
:meth:`vllm.LLMEngine._get_eos_token_id`. | ||
""" | ||
from vllm.transformers_utils.config import try_get_generation_config | ||
from vllm.transformers_utils.tokenizer import get_tokenizer | ||
|
||
|
||
def test_get_llama3_eos_token(): | ||
model_name = "meta-llama/Meta-Llama-3-8B-Instruct" | ||
|
||
tokenizer = get_tokenizer(model_name) | ||
assert tokenizer.eos_token_id == 128009 | ||
|
||
generation_config = try_get_generation_config(model_name, | ||
trust_remote_code=False) | ||
assert generation_config is not None | ||
assert generation_config.eos_token_id == [128001, 128009] | ||
|
||
|
||
def test_get_blip2_eos_token(): | ||
model_name = "Salesforce/blip2-opt-2.7b" | ||
|
||
tokenizer = get_tokenizer(model_name) | ||
assert tokenizer.eos_token_id == 2 | ||
|
||
generation_config = try_get_generation_config(model_name, | ||
trust_remote_code=False) | ||
assert generation_config is not None | ||
assert generation_config.eos_token_id == 50118 |
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