test_flash_neox.py 1.23 KB
Newer Older
1
2
import pytest

3
4
5

@pytest.fixture(scope="module")
def flash_neox_handle(launcher):
6
    with launcher("stabilityai/stablelm-tuned-alpha-3b", num_shard=1) as handle:
7
        yield handle
8
9
10


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


xuxzh1's avatar
last  
xuxzh1 committed
16
@pytest.mark.release
17
@pytest.mark.skip
18
@pytest.mark.asyncio
19
async def test_flash_neox(flash_neox, response_snapshot):
20
    response = await flash_neox.generate(
21
        "<|USER|>What's your mood today?<|ASSISTANT|>",
22
        max_new_tokens=10,
23
        decoder_input_details=True,
24
25
26
    )

    assert response.details.generated_tokens == 10
27
    assert response == response_snapshot
28
29


xuxzh1's avatar
last  
xuxzh1 committed
30
@pytest.mark.release
31
@pytest.mark.skip
32
@pytest.mark.asyncio
33
async def test_flash_neox_load(flash_neox, generate_load, response_snapshot):
34
35
    responses = await generate_load(
        flash_neox,
36
        "<|USER|>What's your mood today?<|ASSISTANT|>",
37
38
39
40
        max_new_tokens=10,
        n=4,
    )

41
42
43
    generated_texts = [r.generated_text for r in responses]

    assert len(generated_texts) == 4
44
    assert all(
45
        [text == generated_texts[0] for text in generated_texts]
46
    ), generated_texts
47

48
    assert responses == response_snapshot