[ROCm][CI] Solidify entrypoint LLM lifecycle (#51280)
Signed-off-by: Andreas Karatzas <Andreas.Karatzas@amd.com> Signed-off-by: Andreas Karatzas <akaratza@amd.com>
This commit is contained in:
@@ -4,30 +4,35 @@
|
||||
import pytest
|
||||
import torch
|
||||
|
||||
from vllm import LLM
|
||||
from vllm.exceptions import VLLMValidationError
|
||||
|
||||
|
||||
def test_empty_prompt():
|
||||
llm = LLM(model="openai-community/gpt2", enforce_eager=True)
|
||||
with pytest.raises(VLLMValidationError, match="decoder prompt cannot be empty"):
|
||||
llm.generate([""])
|
||||
def test_empty_prompt(vllm_runner):
|
||||
with (
|
||||
vllm_runner("openai-community/gpt2", enforce_eager=True) as runner,
|
||||
pytest.raises(VLLMValidationError, match="decoder prompt cannot be empty"),
|
||||
):
|
||||
runner.llm.generate([""])
|
||||
|
||||
|
||||
def test_out_of_vocab_token():
|
||||
llm = LLM(model="openai-community/gpt2", enforce_eager=True)
|
||||
with pytest.raises(VLLMValidationError, match="out of vocabulary"):
|
||||
llm.generate({"prompt_token_ids": [999999]})
|
||||
def test_out_of_vocab_token(vllm_runner):
|
||||
with (
|
||||
vllm_runner("openai-community/gpt2", enforce_eager=True) as runner,
|
||||
pytest.raises(VLLMValidationError, match="out of vocabulary"),
|
||||
):
|
||||
runner.llm.generate({"prompt_token_ids": [999999]})
|
||||
|
||||
|
||||
def test_require_mm_embeds():
|
||||
llm = LLM(
|
||||
model="llava-hf/llava-1.5-7b-hf",
|
||||
enforce_eager=True,
|
||||
enable_mm_embeds=False,
|
||||
)
|
||||
with pytest.raises(ValueError, match="--enable-mm-embeds"):
|
||||
llm.generate(
|
||||
def test_require_mm_embeds(vllm_runner):
|
||||
with (
|
||||
vllm_runner(
|
||||
"llava-hf/llava-1.5-7b-hf",
|
||||
enforce_eager=True,
|
||||
enable_mm_embeds=False,
|
||||
) as runner,
|
||||
pytest.raises(ValueError, match="--enable-mm-embeds"),
|
||||
):
|
||||
runner.llm.generate(
|
||||
{
|
||||
"prompt": "<image>",
|
||||
"multi_modal_data": {"image": torch.empty(1, 1, 1)},
|
||||
|
||||
Reference in New Issue
Block a user