Skip to content

Commit

Permalink
♻️ switch to throwing value error
Browse files Browse the repository at this point in the history
Signed-off-by: Prashant Gupta <prashantgupta@us.ibm.com>
  • Loading branch information
prashantgupta24 authored and njhill committed Oct 12, 2024
1 parent f11fef5 commit a033645
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/vllm_tgis_adapter/grpc/grpc_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -886,18 +886,17 @@ async def Tokenize(

if request.return_offsets:
if is_mistral_tokenizer:
logger.warning(
raise ValueError(
"Mistral tokenizer doesn't support "
"return_offsets at the moment. "
)
else:
offsets = [
{"start": start, "end": end}
for start, end in batch_encoding.offset_mapping
if start is not None and end is not None
]
# Truncate offset list if request.truncate_input_tokens
offsets = offsets[-token_count:]
offsets = [
{"start": start, "end": end}
for start, end in batch_encoding.offset_mapping
if start is not None and end is not None
]
# Truncate offset list if request.truncate_input_tokens
offsets = offsets[-token_count:]

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

Expand Down

0 comments on commit a033645

Please sign in to comment.