hf_text-generation-inference/integration-tests/models/test_flash_neox.py

49 lines
1.2 KiB
Python
Raw Permalink Normal View History

2023-05-15 15:36:30 -06:00
import pytest
@pytest.fixture(scope="module")
def flash_neox_handle(launcher):
with launcher("stabilityai/stablelm-tuned-alpha-3b", num_shard=1) as handle:
yield handle
2023-05-15 15:36:30 -06:00
@pytest.fixture(scope="module")
async def flash_neox(flash_neox_handle):
2023-05-31 02:55:59 -06:00
await flash_neox_handle.health(300)
return flash_neox_handle.client
2023-05-15 15:36:30 -06:00
@pytest.mark.release
@pytest.mark.skip
2023-05-15 15:36:30 -06:00
@pytest.mark.asyncio
async def test_flash_neox(flash_neox, response_snapshot):
2023-05-15 15:36:30 -06:00
response = await flash_neox.generate(
"<|USER|>What's your mood today?<|ASSISTANT|>",
2023-05-15 15:36:30 -06:00
max_new_tokens=10,
decoder_input_details=True,
2023-05-15 15:36:30 -06:00
)
assert response.details.generated_tokens == 10
assert response == response_snapshot
2023-05-15 15:36:30 -06:00
@pytest.mark.release
@pytest.mark.skip
2023-05-15 15:36:30 -06:00
@pytest.mark.asyncio
async def test_flash_neox_load(flash_neox, generate_load, response_snapshot):
2023-05-15 15:36:30 -06:00
responses = await generate_load(
flash_neox,
"<|USER|>What's your mood today?<|ASSISTANT|>",
2023-05-15 15:36:30 -06:00
max_new_tokens=10,
n=4,
)
generated_texts = [r.generated_text for r in responses]
assert len(generated_texts) == 4
assert all(
[text == generated_texts[0] for text in generated_texts]
), generated_texts
2023-05-15 15:36:30 -06:00
assert responses == response_snapshot