Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
9d47f64e
Unverified
Commit
9d47f64e
authored
Jun 30, 2024
by
Cyrus Leung
Committed by
GitHub
Jun 30, 2024
Browse files
[CI/Build] [3/3] Reorganize entrypoints tests (#5966)
parent
cff6a1fe
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
19 additions
and
48 deletions
+19
-48
.buildkite/test-pipeline.yaml
.buildkite/test-pipeline.yaml
+2
-2
pyproject.toml
pyproject.toml
+0
-2
tests/entrypoints/llm/__init__.py
tests/entrypoints/llm/__init__.py
+0
-0
tests/entrypoints/llm/test_encode.py
tests/entrypoints/llm/test_encode.py
+1
-3
tests/entrypoints/llm/test_generate.py
tests/entrypoints/llm/test_generate.py
+1
-3
tests/entrypoints/llm/test_generate_multiple_loras.py
tests/entrypoints/llm/test_generate_multiple_loras.py
+1
-3
tests/entrypoints/openai/__init__.py
tests/entrypoints/openai/__init__.py
+0
-0
tests/entrypoints/openai/test_chat.py
tests/entrypoints/openai/test_chat.py
+1
-3
tests/entrypoints/openai/test_completion.py
tests/entrypoints/openai/test_completion.py
+1
-3
tests/entrypoints/openai/test_embedding.py
tests/entrypoints/openai/test_embedding.py
+1
-3
tests/entrypoints/openai/test_guided_processors.py
tests/entrypoints/openai/test_guided_processors.py
+0
-2
tests/entrypoints/openai/test_models.py
tests/entrypoints/openai/test_models.py
+1
-3
tests/entrypoints/openai/test_oot_registration.py
tests/entrypoints/openai/test_oot_registration.py
+0
-3
tests/entrypoints/openai/test_run_batch.py
tests/entrypoints/openai/test_run_batch.py
+0
-0
tests/entrypoints/openai/test_serving_chat.py
tests/entrypoints/openai/test_serving_chat.py
+0
-4
tests/entrypoints/openai/test_vision.py
tests/entrypoints/openai/test_vision.py
+3
-10
tests/utils.py
tests/utils.py
+7
-4
No files found.
.buildkite/test-pipeline.yaml
View file @
9d47f64e
...
...
@@ -89,8 +89,8 @@ steps:
mirror_hardwares
:
[
amd
]
commands
:
-
pytest -v -s entrypoints
-m
llm
-
pytest -v -s entrypoints
-m
openai
-
pytest -v -s entrypoints
/
llm
-
pytest -v -s entrypoints
/
openai
-
label
:
Examples Test
working_dir
:
"
/vllm-workspace/examples"
...
...
pyproject.toml
View file @
9d47f64e
...
...
@@ -69,7 +69,5 @@ skip_gitignore = true
[tool.pytest.ini_options]
markers
=
[
"skip_global_cleanup"
,
"llm: run tests for vLLM API only"
,
"openai: run tests for OpenAI API only"
,
"vlm: run tests for vision language models only"
,
]
tests/entrypoints/llm/__init__.py
0 → 100644
View file @
9d47f64e
tests/entrypoints/test
_llm
_encode.py
→
tests/entrypoints/
llm/
test_encode.py
View file @
9d47f64e
...
...
@@ -5,7 +5,7 @@ import pytest
from
vllm
import
LLM
,
EmbeddingRequestOutput
,
PoolingParams
from
..conftest
import
cleanup
from
..
.
conftest
import
cleanup
MODEL_NAME
=
"intfloat/e5-mistral-7b-instruct"
...
...
@@ -25,8 +25,6 @@ TOKEN_IDS = [
[
1000
,
1003
,
1001
,
1002
],
]
pytestmark
=
pytest
.
mark
.
llm
@
pytest
.
fixture
(
scope
=
"module"
)
def
llm
():
...
...
tests/entrypoints/test
_llm
_generate.py
→
tests/entrypoints/
llm/
test_generate.py
View file @
9d47f64e
...
...
@@ -5,7 +5,7 @@ import pytest
from
vllm
import
LLM
,
RequestOutput
,
SamplingParams
from
..conftest
import
cleanup
from
..
.
conftest
import
cleanup
MODEL_NAME
=
"facebook/opt-125m"
...
...
@@ -23,8 +23,6 @@ TOKEN_IDS = [
[
0
,
3
,
1
,
2
],
]
pytestmark
=
pytest
.
mark
.
llm
@
pytest
.
fixture
(
scope
=
"module"
)
def
llm
():
...
...
tests/entrypoints/test
_llm
_generate_multiple_loras.py
→
tests/entrypoints/
llm/
test_generate_multiple_loras.py
View file @
9d47f64e
...
...
@@ -7,7 +7,7 @@ from huggingface_hub import snapshot_download
from
vllm
import
LLM
from
vllm.lora.request
import
LoRARequest
from
..conftest
import
cleanup
from
..
.
conftest
import
cleanup
MODEL_NAME
=
"HuggingFaceH4/zephyr-7b-beta"
...
...
@@ -20,8 +20,6 @@ PROMPTS = [
LORA_NAME
=
"typeof/zephyr-7b-beta-lora"
pytestmark
=
pytest
.
mark
.
llm
@
pytest
.
fixture
(
scope
=
"module"
)
def
llm
():
...
...
tests/entrypoints/openai/__init__.py
0 → 100644
View file @
9d47f64e
tests/entrypoints/
test_
openai_chat.py
→
tests/entrypoints/openai
/test
_chat.py
View file @
9d47f64e
...
...
@@ -14,7 +14,7 @@ import torch
from
huggingface_hub
import
snapshot_download
from
openai
import
BadRequestError
from
..utils
import
RemoteOpenAIServer
from
..
.
utils
import
RemoteOpenAIServer
# any model with a chat template should work here
MODEL_NAME
=
"HuggingFaceH4/zephyr-7b-beta"
...
...
@@ -69,8 +69,6 @@ TEST_CHOICE = [
"Swift"
,
"Kotlin"
]
pytestmark
=
pytest
.
mark
.
openai
@
pytest
.
fixture
(
scope
=
"module"
)
def
zephyr_lora_files
():
...
...
tests/entrypoints/
test_
openai_completion.py
→
tests/entrypoints/openai
/test
_completion.py
View file @
9d47f64e
...
...
@@ -16,7 +16,7 @@ from openai import BadRequestError
from
vllm.transformers_utils.tokenizer
import
get_tokenizer
from
..utils
import
RemoteOpenAIServer
from
..
.
utils
import
RemoteOpenAIServer
# any model with a chat template should work here
MODEL_NAME
=
"HuggingFaceH4/zephyr-7b-beta"
...
...
@@ -71,8 +71,6 @@ TEST_CHOICE = [
"Swift"
,
"Kotlin"
]
pytestmark
=
pytest
.
mark
.
openai
@
pytest
.
fixture
(
scope
=
"module"
)
def
zephyr_lora_files
():
...
...
tests/entrypoints/
test_
openai_embedding.py
→
tests/entrypoints/openai
/test
_embedding.py
View file @
9d47f64e
...
...
@@ -2,12 +2,10 @@ import openai
import
pytest
import
ray
from
..utils
import
RemoteOpenAIServer
from
..
.
utils
import
RemoteOpenAIServer
EMBEDDING_MODEL_NAME
=
"intfloat/e5-mistral-7b-instruct"
pytestmark
=
pytest
.
mark
.
openai
@
pytest
.
fixture
(
scope
=
"module"
)
def
ray_ctx
():
...
...
tests/entrypoints/test_guided_processors.py
→
tests/entrypoints/
openai/
test_guided_processors.py
View file @
9d47f64e
...
...
@@ -52,8 +52,6 @@ TEST_SCHEMA = {
TEST_REGEX
=
(
r
"((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.){3}"
r
"(25[0-5]|(2[0-4]|1\d|[1-9]|)\d)"
)
pytestmark
=
pytest
.
mark
.
openai
def
test_guided_logits_processors
():
"""Basic unit test for RegexLogitsProcessor and JSONLogitsProcessor."""
...
...
tests/entrypoints/
test_
openai
_server
.py
→
tests/entrypoints/openai
/test_models
.py
View file @
9d47f64e
...
...
@@ -6,7 +6,7 @@ import ray
# downloading lora to test lora requests
from
huggingface_hub
import
snapshot_download
from
..utils
import
RemoteOpenAIServer
from
..
.
utils
import
RemoteOpenAIServer
# any model with a chat template should work here
MODEL_NAME
=
"HuggingFaceH4/zephyr-7b-beta"
...
...
@@ -14,8 +14,6 @@ MODEL_NAME = "HuggingFaceH4/zephyr-7b-beta"
# generation quality here
LORA_NAME
=
"typeof/zephyr-7b-beta-lora"
pytestmark
=
pytest
.
mark
.
openai
@
pytest
.
fixture
(
scope
=
"module"
)
def
zephyr_lora_files
():
...
...
tests/entrypoints/
test_server
_oot_registration.py
→
tests/entrypoints/
openai/test
_oot_registration.py
View file @
9d47f64e
import
sys
import
time
import
pytest
import
torch
from
openai
import
OpenAI
,
OpenAIError
...
...
@@ -10,8 +9,6 @@ from vllm.model_executor.models.opt import OPTForCausalLM
from
vllm.model_executor.sampling_metadata
import
SamplingMetadata
from
vllm.utils
import
get_open_port
pytestmark
=
pytest
.
mark
.
openai
class
MyOPTForCausalLM
(
OPTForCausalLM
):
...
...
tests/entrypoints/
test_
openai_run_batch.py
→
tests/entrypoints/openai
/test
_run_batch.py
View file @
9d47f64e
File moved
tests/entrypoints/openai/test_serving_chat.py
View file @
9d47f64e
import
asyncio
from
dataclasses
import
dataclass
import
pytest
from
vllm.entrypoints.openai.serving_chat
import
OpenAIServingChat
MODEL_NAME
=
"openai-community/gpt2"
CHAT_TEMPLATE
=
"Dummy chat template for testing {}"
pytestmark
=
pytest
.
mark
.
openai
@
dataclass
class
MockModelConfig
:
...
...
tests/entrypoints/
test_
openai_vision.py
→
tests/entrypoints/openai
/test
_vision.py
View file @
9d47f64e
from
pathlib
import
Path
from
typing
import
Dict
,
List
import
openai
...
...
@@ -8,12 +7,12 @@ import ray
from
vllm.multimodal.utils
import
ImageFetchAiohttp
,
encode_image_base64
from
..utils
import
RemoteOpenAIServer
from
..
.
utils
import
VLLM_PATH
,
RemoteOpenAIServer
MODEL_NAME
=
"llava-hf/llava-1.5-7b-hf"
LLAVA_CHAT_TEMPLATE
=
(
Path
(
__file__
).
parent
.
parent
.
parent
/
"examples/template_llava.jinja"
)
LLAVA_CHAT_TEMPLATE
=
VLLM_PATH
/
"examples/template_llava.jinja"
assert
LLAVA_CHAT_TEMPLATE
.
exists
()
# Test different image extensions (JPG/PNG) and formats (gray/RGB/RGBA)
TEST_IMAGE_URLS
=
[
"https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"
,
...
...
@@ -22,8 +21,6 @@ TEST_IMAGE_URLS = [
"https://upload.wikimedia.org/wikipedia/commons/0/0b/RGBA_comp.png"
,
]
pytestmark
=
pytest
.
mark
.
openai
@
pytest
.
fixture
(
scope
=
"module"
)
def
ray_ctx
():
...
...
@@ -279,7 +276,3 @@ async def test_multi_image_input(client: openai.AsyncOpenAI, model_name: str,
)
completion
=
completion
.
choices
[
0
].
text
assert
completion
is
not
None
and
len
(
completion
)
>=
0
if
__name__
==
"__main__"
:
pytest
.
main
([
__file__
])
tests/utils.py
View file @
9d47f64e
...
...
@@ -4,7 +4,8 @@ import sys
import
time
import
warnings
from
contextlib
import
contextmanager
from
typing
import
Dict
,
List
from
pathlib
import
Path
from
typing
import
Any
,
Dict
,
List
import
openai
import
ray
...
...
@@ -40,8 +41,8 @@ else:
nvmlShutdown
()
# Path to root of repository so that utilities can be imported by ray workers
VLLM_PATH
=
os
.
path
.
abspath
(
os
.
path
.
join
(
__file__
,
os
.
pardir
,
os
.
pardir
))
VLLM_PATH
=
Path
(
__file__
).
parent
.
parent
"""Path to root of the vLLM repository."""
class
RemoteOpenAIServer
:
...
...
@@ -153,10 +154,12 @@ def init_test_distributed_environment(
def
multi_process_parallel
(
tp_size
:
int
,
pp_size
:
int
,
test_target
,
test_target
:
Any
,
)
->
None
:
# Using ray helps debugging the error when it failed
# as compared to multiprocessing.
# NOTE: We need to set working_dir for distributed tests,
# otherwise we may get import errors on ray workers
ray
.
init
(
runtime_env
=
{
"working_dir"
:
VLLM_PATH
})
distributed_init_port
=
get_open_port
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment