main
py 101 lines 2.62 KB
Raw
1 # SPDX-License-Identifier: Apache-2.0
2 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
4 import pytest
5
6
7 @pytest.fixture
8 def sample_prompts():
9 return [
10 "Hello, my name is",
11 "The president of the United States is",
12 "The capital of France is",
13 "The future of AI is",
14 ]
15
16
17 @pytest.fixture
18 def sample_regex():
19 return (
20 r"((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.){3}"
21 r"(25[0-5]|(2[0-4]|1\d|[1-9]|)\d)"
22 )
23
24
25 @pytest.fixture
26 def sample_json_schema():
27 return {
28 "type": "object",
29 "properties": {
30 "name": {"type": "string"},
31 "age": {"type": "integer"},
32 "skills": {
33 "type": "array",
34 "items": {"type": "string", "maxLength": 10},
35 "minItems": 3,
36 },
37 "work_history": {
38 "type": "array",
39 "items": {
40 "type": "object",
41 "properties": {
42 "company": {"type": "string"},
43 "duration": {"type": "number"},
44 "position": {"type": "string"},
45 },
46 "required": ["company", "position"],
47 },
48 },
49 },
50 "required": ["name", "age", "skills", "work_history"],
51 }
52
53
54 @pytest.fixture
55 def sample_structured_outputs_choices():
56 return [
57 "Python",
58 "Java",
59 "JavaScript",
60 "C++",
61 "C#",
62 "PHP",
63 "TypeScript",
64 "Ruby",
65 "Swift",
66 "Kotlin",
67 ]
68
69
70 @pytest.fixture(scope="session")
71 def qwen3_lora_files():
72 """Download Qwen3 LoRA files once per test session."""
73 from vllm.transformers_utils.repo_utils import hf_api
74
75 return hf_api().snapshot_download(repo_id="charent/self_cognition_Alice")
76
77
78 @pytest.fixture(scope="session")
79 def qwen3_meowing_lora_files():
80 """Download Qwen3 LoRA files once per test session."""
81 from vllm.transformers_utils.repo_utils import hf_api
82
83 return hf_api().snapshot_download(repo_id="Jackmin108/Qwen3-0.6B-Meow-LoRA")
84
85
86 @pytest.fixture(scope="session")
87 def qwen3_woofing_lora_files():
88 """Download Qwen3 LoRA files once per test session."""
89 from vllm.transformers_utils.repo_utils import hf_api
90
91 return hf_api().snapshot_download(repo_id="Jackmin108/Qwen3-0.6B-Woof-LoRA")
92
93
94 @pytest.fixture(scope="session")
95 def opt125_lora_files() -> str:
96 """Download opt-125m LoRA files once per test session."""
97 from vllm.transformers_utils.repo_utils import hf_api
98
99 return hf_api().snapshot_download(
100 repo_id="peft-internal-testing/opt-125m-dummy-lora"
101 )