Skip to content

Commit

Permalink
Skip tokenize/detokenize when it is disabled by arg --skip-tokenizer-…
Browse files Browse the repository at this point in the history
…init (#367)

* switching detokenize flag to be False

* detokenize = False for benchmarks

* restoring default in main vllm code for detokenize

* removing extra spaces

* moving detokenize to flag

* adding support for token ids

---------

Co-authored-by: maleksan85 <maleksan@amd.com>
  • Loading branch information
maleksan85 and maleksan85 authored Jan 22, 2025
1 parent 78d7d30 commit b5839a1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion benchmarks/profiling/benchmark_throughput.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ def main(args: argparse.Namespace):
args.tokenizer, trust_remote_code=args.trust_remote_code)
if args.dataset is None:
# Synthesize a prompt with the given input length.
prompt = "hi" * (args.input_len - 1)
prompt = { "prompt_token_ids" : [42] * (args.input_len - 1) } \
if args.skip_tokenizer_init else "hi" * (args.input_len - 1)
requests = [(prompt, args.input_len, args.output_len)
for _ in range(args.num_prompts)]
else:
Expand Down
2 changes: 1 addition & 1 deletion vllm/engine/output_processor/multi_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def process_outputs(self,
def _process_decode_and_stop(self, seq: Sequence,
sampling_params: SamplingParams) -> None:
new_char_count = 0
if sampling_params.detokenize:
if sampling_params.detokenize and self.detokenizer:
new_char_count = self.detokenizer.decode_sequence_inplace(
seq, sampling_params)

Expand Down

0 comments on commit b5839a1

Please sign in to comment.