Skip to content

Commit 01f11e5

Browse files
prashantgupta24joerunde
authored andcommitted
✅ add test for prompt adapter
1 parent 260ae9c commit 01f11e5

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"num_virtual_tokens": 8,
3+
"peft_type": "PROMPT_TUNING"
4+
}

tests/test_adapters.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from pathlib import Path
2+
3+
import pytest
4+
5+
from vllm_tgis_adapter.grpc.adapters import AdapterStore, validate_adapters
6+
from vllm_tgis_adapter.grpc.pb.generation_pb2 import (
7+
BatchedGenerationRequest,
8+
)
9+
10+
FIXTURES_DIR = Path(__file__).parent / "fixtures"
11+
12+
13+
@pytest.mark.asyncio
14+
async def test_validate_adapters():
15+
adapter_name = "bloom_sentiment_1"
16+
request = BatchedGenerationRequest(
17+
adapter_id=adapter_name,
18+
)
19+
20+
adapters = await validate_adapters(
21+
request, AdapterStore(cache_path=FIXTURES_DIR, adapters={})
22+
)
23+
assert "prompt_adapter_request" in adapters
24+
assert adapters["prompt_adapter_request"].prompt_adapter_name == adapter_name
25+
adapter_path = adapters["prompt_adapter_request"].prompt_adapter_local_path
26+
assert adapter_path is not None
27+
28+
assert Path.exists(Path(adapter_path) / "adapter_config.json")
29+
assert Path.exists(Path(adapter_path) / "adapter_model.safetensors")

0 commit comments

Comments
 (0)