2022-12-08 10:49:33 -07:00
|
|
|
import pytest
|
2024-08-29 08:29:01 -06:00
|
|
|
import os
|
2023-03-07 10:52:22 -07:00
|
|
|
from text_generation_server.pb import generate_pb2
|
2022-12-08 10:49:33 -07:00
|
|
|
|
2024-08-29 08:29:01 -06:00
|
|
|
os.environ["USE_PREFIX_CACHING"] = "1"
|
|
|
|
os.environ["ATTENTION"] = "flashinfer"
|
|
|
|
|
2022-12-08 10:49:33 -07:00
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def default_pb_parameters():
|
2022-12-15 09:03:56 -07:00
|
|
|
return generate_pb2.NextTokenChooserParameters(
|
2022-12-08 10:49:33 -07:00
|
|
|
temperature=1.0,
|
2023-02-01 07:58:42 -07:00
|
|
|
repetition_penalty=1.0,
|
2022-12-08 10:49:33 -07:00
|
|
|
top_k=0,
|
|
|
|
top_p=1.0,
|
2023-03-09 03:33:57 -07:00
|
|
|
typical_p=1.0,
|
2022-12-08 10:49:33 -07:00
|
|
|
do_sample=False,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2022-12-12 10:25:22 -07:00
|
|
|
@pytest.fixture
|
|
|
|
def default_pb_stop_parameters():
|
|
|
|
return generate_pb2.StoppingCriteriaParameters(stop_sequences=[], max_new_tokens=10)
|