2023-07-21 02:59:00 -06:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
|
|
def flash_starcoder_gptq_handle(launcher):
|
|
|
|
with launcher("Narsil/starcoder-gptq", num_shard=2, quantize="gptq") as handle:
|
|
|
|
yield handle
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
|
|
async def flash_starcoder_gptq(flash_starcoder_gptq_handle):
|
|
|
|
await flash_starcoder_gptq_handle.health(300)
|
|
|
|
return flash_starcoder_gptq_handle.client
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
|
|
@pytest.mark.private
|
2023-11-28 13:22:35 -07:00
|
|
|
async def test_flash_starcoder_gptq(flash_starcoder_gptq, generous_response_snapshot):
|
2023-07-21 02:59:00 -06:00
|
|
|
response = await flash_starcoder_gptq.generate(
|
2023-07-24 03:43:58 -06:00
|
|
|
"def geometric_mean(L: List[float]):",
|
|
|
|
max_new_tokens=20,
|
|
|
|
decoder_input_details=True,
|
2023-07-21 02:59:00 -06:00
|
|
|
)
|
|
|
|
assert response.details.generated_tokens == 20
|
2023-11-28 13:22:35 -07:00
|
|
|
assert response == generous_response_snapshot
|
2023-07-21 02:59:00 -06:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
|
|
@pytest.mark.private
|
2023-07-24 03:43:58 -06:00
|
|
|
async def test_flash_starcoder_gptq_default_params(
|
2023-11-28 13:22:35 -07:00
|
|
|
flash_starcoder_gptq, generous_response_snapshot
|
2023-07-24 03:43:58 -06:00
|
|
|
):
|
2023-07-21 02:59:00 -06:00
|
|
|
response = await flash_starcoder_gptq.generate(
|
|
|
|
"def geometric_mean(L: List[float]):",
|
|
|
|
max_new_tokens=20,
|
|
|
|
temperature=0.2,
|
|
|
|
top_p=0.95,
|
|
|
|
decoder_input_details=True,
|
|
|
|
seed=0,
|
|
|
|
)
|
|
|
|
assert response.details.generated_tokens == 20
|
2023-11-28 13:22:35 -07:00
|
|
|
assert response == generous_response_snapshot
|
2023-07-21 02:59:00 -06:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
|
|
@pytest.mark.private
|
2023-07-24 03:43:58 -06:00
|
|
|
async def test_flash_starcoder_gptq_load(
|
2023-11-28 13:22:35 -07:00
|
|
|
flash_starcoder_gptq, generate_load, generous_response_snapshot
|
2023-07-24 03:43:58 -06:00
|
|
|
):
|
|
|
|
responses = await generate_load(
|
|
|
|
flash_starcoder_gptq,
|
|
|
|
"def geometric_mean(L: List[float]):",
|
|
|
|
max_new_tokens=10,
|
|
|
|
n=4,
|
|
|
|
)
|
2023-07-21 02:59:00 -06:00
|
|
|
|
|
|
|
assert len(responses) == 4
|
|
|
|
assert all([r.generated_text == responses[0].generated_text for r in responses])
|
|
|
|
|
2023-11-28 13:22:35 -07:00
|
|
|
assert responses == generous_response_snapshot
|