Skip to content

Commit

Permalink
fix generated string
Browse files Browse the repository at this point in the history
  • Loading branch information
Dipika Sikka committed Mar 14, 2024
1 parent fd3b0d8 commit 210c49c
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def _generate_streamed_text_from_past_tokens(
past_tokens_queue, skip_special_tokens=True
)
past_tokens_queue.pop(0)
return string_from_n_plus_1_tokens[len(string_from_n_tokens) :]
return [string_from_n_plus_1_tokens[len(string_from_n_tokens) :]]

def run(
self,
Expand All @@ -93,7 +93,11 @@ def run(
generated_logits = generated_logits if generation_config.output_scores else None

import transformers
if isinstance(self.tokenizer, (transformers.LlamaTokenizer, transformers.LlamaTokenizerFast)):

if isinstance(
self.tokenizer,
(transformers.LlamaTokenizer, transformers.LlamaTokenizerFast),
):
past_tokens_queue = inference_state.current_state.get("past_tokens_queue")
sequences = self._generate_streamed_text_from_past_tokens(
generated_tokens, past_tokens_queue
Expand Down

0 comments on commit 210c49c

Please sign in to comment.