test_prompt_validation.py 403 Bytes
Newer Older
1
2
3
4
5
6
import pytest

from vllm import LLM


def test_empty_prompt():
7
    llm = LLM(model="gpt2", enforce_eager=True)
8
9
    with pytest.raises(ValueError, match='Prompt cannot be empty'):
        llm.generate([""])
10
11
12
13
14
15


def test_out_of_vocab_token():
    llm = LLM(model="gpt2", enforce_eager=True)
    with pytest.raises(ValueError, match='out of vocabulary'):
        llm.generate({"prompt_token_ids": [999999]})