Skip to content

Commit a033645

Browse files
prashantgupta24njhill
authored andcommitted
♻️ switch to throwing value error
Signed-off-by: Prashant Gupta <[email protected]>
1 parent f11fef5 commit a033645

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/vllm_tgis_adapter/grpc/grpc_server.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -886,18 +886,17 @@ async def Tokenize(
886886

887887
if request.return_offsets:
888888
if is_mistral_tokenizer:
889-
logger.warning(
889+
raise ValueError(
890890
"Mistral tokenizer doesn't support "
891891
"return_offsets at the moment. "
892892
)
893-
else:
894-
offsets = [
895-
{"start": start, "end": end}
896-
for start, end in batch_encoding.offset_mapping
897-
if start is not None and end is not None
898-
]
899-
# Truncate offset list if request.truncate_input_tokens
900-
offsets = offsets[-token_count:]
893+
offsets = [
894+
{"start": start, "end": end}
895+
for start, end in batch_encoding.offset_mapping
896+
if start is not None and end is not None
897+
]
898+
# Truncate offset list if request.truncate_input_tokens
899+
offsets = offsets[-token_count:]
901900

902901
tokens = tokens[-token_count:] if request.return_tokens else None
903902

0 commit comments

Comments
 (0)