-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
7e65477
commit f8e7add
Showing
5 changed files
with
73 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import asyncio | ||
from dataclasses import dataclass | ||
|
||
from vllm.entrypoints.openai.serving_chat import OpenAIServingChat | ||
|
||
MODEL_NAME = "openai-community/gpt2" | ||
CHAT_TEMPLATE = "Dummy chat template for testing {}" | ||
|
||
|
||
@dataclass | ||
class MockModelConfig: | ||
tokenizer = MODEL_NAME | ||
trust_remote_code = False | ||
tokenizer_mode = "auto" | ||
max_model_len = 100 | ||
tokenizer_revision = None | ||
|
||
|
||
@dataclass | ||
class MockEngine: | ||
|
||
async def get_model_config(self): | ||
return MockModelConfig | ||
|
||
|
||
async def _async_serving_chat_init(): | ||
serving_completion = OpenAIServingChat(MockEngine(), | ||
served_model_names=[MODEL_NAME], | ||
response_role="assistant", | ||
chat_template=CHAT_TEMPLATE) | ||
return serving_completion | ||
|
||
|
||
def test_async_serving_chat_init(): | ||
serving_completion = asyncio.run(_async_serving_chat_init()) | ||
assert serving_completion.tokenizer is not None | ||
assert serving_completion.tokenizer.chat_template == CHAT_TEMPLATE |
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