Add support for spaces_between_special_tokens

This commit is contained in:
Dan Lord
2023-10-30 16:52:56 -07:00
committed by GitHub
parent 79a30912b8
commit 7013a80170
5 changed files with 28 additions and 7 deletions
+4
View File
@@ -212,6 +212,7 @@ async def create_chat_completion(request: ChatCompletionRequest,
request_id = f"cmpl-{random_uuid()}"
created_time = int(time.monotonic())
try:
spaces_between_special_tokens = request.spaces_between_special_tokens
sampling_params = SamplingParams(
n=request.n,
presence_penalty=request.presence_penalty,
@@ -226,6 +227,7 @@ async def create_chat_completion(request: ChatCompletionRequest,
ignore_eos=request.ignore_eos,
use_beam_search=request.use_beam_search,
skip_special_tokens=request.skip_special_tokens,
spaces_between_special_tokens=spaces_between_special_tokens,
)
except ValueError as e:
return create_error_response(HTTPStatus.BAD_REQUEST, str(e))
@@ -413,6 +415,7 @@ async def create_completion(request: CompletionRequest, raw_request: Request):
created_time = int(time.monotonic())
try:
spaces_between_special_tokens = request.spaces_between_special_tokens
sampling_params = SamplingParams(
n=request.n,
best_of=request.best_of,
@@ -428,6 +431,7 @@ async def create_completion(request: CompletionRequest, raw_request: Request):
logprobs=request.logprobs,
use_beam_search=request.use_beam_search,
skip_special_tokens=request.skip_special_tokens,
spaces_between_special_tokens=spaces_between_special_tokens,
)
except ValueError as e:
return create_error_response(HTTPStatus.BAD_REQUEST, str(e))