"vscode:/vscode.git/clone" did not exist on "94fb4e9e54efd9b6f28ff347d880c417b694b7c1"
test_flash_santacoder.py 1.05 KB
Newer Older
1
2
import pytest

3
4
5
6
7

@pytest.fixture(scope="module")
def flash_santacoder_handle(launcher):
    with launcher("bigcode/santacoder") as handle:
        yield handle
8
9
10


@pytest.fixture(scope="module")
11
async def flash_santacoder(flash_santacoder_handle):
OlivierDehaene's avatar
OlivierDehaene committed
12
    await flash_santacoder_handle.health(300)
13
    return flash_santacoder_handle.client
14
15


16
@pytest.mark.release
17
@pytest.mark.asyncio
18
async def test_flash_santacoder(flash_santacoder, response_snapshot):
19
20
21
    response = await flash_santacoder.generate(
        "def print_hello", max_new_tokens=10, decoder_input_details=True
    )
22
23

    assert response.details.generated_tokens == 10
24
    assert response == response_snapshot
25
26


27
@pytest.mark.release
28
@pytest.mark.asyncio
29
30
31
async def test_flash_santacoder_load(
    flash_santacoder, generate_load, response_snapshot
):
32
33
34
35
36
    responses = await generate_load(
        flash_santacoder, "def print_hello", max_new_tokens=10, n=4
    )

    assert len(responses) == 4
37
    assert all([r.generated_text == responses[0].generated_text for r in responses])
38

39
    assert responses == response_snapshot