Skip to content

Commit

Permalink
Fix and clean test
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkLight1337 committed Aug 7, 2024
1 parent a77db25 commit d762e39
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
8 changes: 3 additions & 5 deletions tests/async_engine/test_chat_template.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import os
import pathlib

import pytest

from vllm.entrypoints.chat_utils import apply_chat_template, load_chat_template
from vllm.entrypoints.openai.protocol import ChatCompletionRequest
from vllm.transformers_utils.tokenizer import get_tokenizer

chatml_jinja_path = pathlib.Path(os.path.dirname(os.path.abspath(
__file__))).parent.parent / "examples/template_chatml.jinja"
from ..utils import VLLM_PATH

chatml_jinja_path = VLLM_PATH / "examples/template_chatml.jinja"
assert chatml_jinja_path.exists()

# Define models, templates, and their corresponding expected outputs
Expand Down
10 changes: 3 additions & 7 deletions tests/async_engine/test_openapi_server_ray.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import os
import pathlib

import openai # use the official client for correctness check
import pytest

from ..utils import RemoteOpenAIServer
from ..utils import VLLM_PATH, RemoteOpenAIServer

# any model with a chat template should work here
MODEL_NAME = "facebook/opt-125m"
chatml_jinja_path = pathlib.Path(os.path.dirname(os.path.abspath(
__file__))).parent.parent / "examples/template_chatml.jinja"
chatml_jinja_path = VLLM_PATH / "examples/template_chatml.jinja"
assert chatml_jinja_path.exists()


Expand Down Expand Up @@ -91,7 +87,7 @@ async def test_single_chat_session(client: openai.AsyncOpenAI):
choice = chat_completion.choices[0]
assert choice.finish_reason == "length"
assert chat_completion.usage == openai.types.CompletionUsage(
completion_tokens=10, prompt_tokens=13, total_tokens=23)
completion_tokens=10, prompt_tokens=55, total_tokens=65)

message = choice.message
assert message.content is not None and len(message.content) >= 10
Expand Down

0 comments on commit d762e39

Please sign in to comment.