test_flash_neox.py 1.19 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


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

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


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

39
40
41
    generated_texts = [r.generated_text for r in responses]

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

46
    assert responses == response_snapshot